diff --git a/lib/core/Prism.js b/lib/core/Prism.js index 3030745466..b75f2834e6 100644 --- a/lib/core/Prism.js +++ b/lib/core/Prism.js @@ -256,9 +256,9 @@ const Prism = { const strarr = [text]; - const rest = grammar.rest; - if (rest) { + if (grammar && grammar.rest) { + const rest = grammar.rest; for (var token in rest) { grammar[token] = rest[token]; }