diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js
index 959f21f..78f0c50 100644
--- a/IPython/html/static/notebook/js/cell.js
+++ b/IPython/html/static/notebook/js/cell.js
@@ -323,7 +323,12 @@ var IPython = (function (IPython) {
}
}
// fallback on default
- var default_mode = this._options.cm_config.mode || 'text/plain';
+ var default_mode
+ try {
+ default_mode = this._options.cm_config.mode;
+ } catch(e) {
+ default_mode = 'text/plain';
+ }
this.code_mirror.setOption('mode', default_mode);
};