From 68cfe099df786804c380ec8a64eea0f8e8268959 Mon Sep 17 00:00:00 2001 From: Bernard Lambeau Date: Tue, 29 Sep 2015 09:01:13 +0200 Subject: [PATCH] Check for the presence of `env` before `env.references`. This commit fixes a "Cannot read property 'references' of undefined" when parsing "[xxx]". state.env is sometimes undefined, and so are references as well. --- lib/rules_inline/link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules_inline/link.js b/lib/rules_inline/link.js index b4a8808..6819c7c 100644 --- a/lib/rules_inline/link.js +++ b/lib/rules_inline/link.js @@ -95,7 +95,7 @@ module.exports = function link(state, silent) { // // Link reference // - if (typeof state.env.references === 'undefined') { return false; } + if (typeof state.env === 'undefined' || typeof state.env.references === 'undefined') { return false; } // [foo] [bar] // ^^ optional whitespace (can include newlines)