diff --git a/static/chat/index.js b/static/chat/index.js index 980d8ff..6e4610e 100755 --- a/static/chat/index.js +++ b/static/chat/index.js @@ -98,9 +98,9 @@ $(function() { // Send a new message to the general channel var $input = $('#chat-input'); $input.on('keydown', function(e) { - if (e.keyCode == 13) { + if (e.keyCode == 13 && generalChannel) { generalChannel.sendMessage($input.val()) $input.val(''); } }); -}); \ No newline at end of file +});