From d8665da1b18c3485ed528a9f7c08515a2adaa7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Prochowski?= Date: Wed, 13 Jun 2012 00:50:49 +0200 Subject: [PATCH] Fixed javascript error "b is null" in codemirror.js on line 1. --- web/js/main.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/web/js/main.js b/web/js/main.js index 55790ae..6d6358e 100755 --- a/web/js/main.js +++ b/web/js/main.js @@ -1,12 +1,14 @@ $(function () { $('.dropdown-toggle').dropdown(); - var mode = $('#sourcecode').attr('language'); - CodeMirror.fromTextArea(document.getElementById("sourcecode"), { - lineNumbers: true, - matchBrackets: true, - lineWrapping: true, - readOnly: true, - mode: mode - }); -}); + if ($('#sourcecode').length) { + var mode = $('#sourcecode').attr('language'); + CodeMirror.fromTextArea(document.getElementById("sourcecode"), { + lineNumbers: true, + matchBrackets: true, + lineWrapping: true, + readOnly: true, + mode: mode + }); + }; +}); \ No newline at end of file