From f6f3ab5b822c8273f9f72d3ed50bffd79bb96742 Mon Sep 17 00:00:00 2001 From: mAAdhaTTah Date: Tue, 26 Sep 2017 22:59:32 -0400 Subject: [PATCH] Check if tokens exists and return If the language was autoloaded, the grammar may not exist yet. We need to check if it exists before we attempt to modify it. --- plugins/show-invisibles/prism-show-invisibles.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/show-invisibles/prism-show-invisibles.js b/plugins/show-invisibles/prism-show-invisibles.js index 72833fa949..f3d120a9e8 100644 --- a/plugins/show-invisibles/prism-show-invisibles.js +++ b/plugins/show-invisibles/prism-show-invisibles.js @@ -10,6 +10,8 @@ if ( Prism.hooks.add('before-highlight', function(env) { var tokens = env.grammar; + if (!tokens) return; + tokens.tab = /\t/g; tokens.crlf = /\r\n/g; tokens.lf = /\n/g;