From 80c29be19fb716c900a64ebd861fbf6de45597c9 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 24 Apr 2013 10:50:11 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20crasher=20on=20:fr:126e=5Fm=C3=A9ridien?= =?UTF-8?q?=5Fouest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code is being run on: which doesn't have a 'typeof' attribute, and so the match is crashing with a null pointer dereference. Turn the expression around. RegExp.test is more efficient, and it handles a null argument with no problems. Add start/end anchors to the regexp while we're at it. Change-Id: I11bc9fdc902a21ce0bc1c05f08d3b615d5483e2e --- js/lib/ext.Cite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/lib/ext.Cite.js b/js/lib/ext.Cite.js index b49b088dc..3b3b81835 100644 --- a/js/lib/ext.Cite.js +++ b/js/lib/ext.Cite.js @@ -345,7 +345,7 @@ References.prototype.handleReferences = function ( manager, pipelineOpts, refsTo var t = chunk[i]; if (t.constructor === SelfclosingTagTk && t.name === 'meta' && - t.getAttribute('typeof').match(/mw:Ext\/Ref\/Content/)) + /^mw:Ext\/Ref\/Content$/.test(t.getAttribute('typeof'))) { res.push(t); }