Skip to content

Commit 76ce16c

Browse files
committed
Handle the case where no mode is loaded a little more gracefully
1 parent 1bd450b commit 76ce16c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/codemirror.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,14 +1439,14 @@ var CodeMirror = (function() {
14391439
spec = mimeModes[spec];
14401440
if (typeof spec == "string")
14411441
var mname = spec, config = {};
1442-
else
1442+
else if (spec != null)
14431443
var mname = spec.name, config = spec;
14441444
var mfactory = modes[mname];
14451445
if (!mfactory) {
14461446
if (window.console) console.warn("No mode " + mname + " found, falling back to plain text.");
14471447
return CodeMirror.getMode(options, "text/plain");
14481448
}
1449-
return mfactory(options, config);
1449+
return mfactory(options, config || {});
14501450
}
14511451
CodeMirror.listModes = function() {
14521452
var list = [];

0 commit comments

Comments
 (0)