diff --git a/IPython/html/static/edit/js/editor.js b/IPython/html/static/edit/js/editor.js
index c1f607b..481507c 100644
--- a/IPython/html/static/edit/js/editor.js
+++ b/IPython/html/static/edit/js/editor.js
@@ -100,7 +100,9 @@ function($,
// Find and load the highlighting mode,
// first by mime-type, then by file extension
+
var modeinfo;
+ // mimetype is unset on file rename
if (model.mimetype) {
modeinfo = CodeMirror.findModeByMIME(model.mimetype);
}