From 880449208903c556ffd8c31ae0ae241235f82714 Mon Sep 17 00:00:00 2001 From: Kevin Ndung'u Gathuku Date: Sun, 19 Nov 2017 16:06:24 +0300 Subject: [PATCH] Only send message if generalChannel is available Ensure generalChannel is available before attempting to send a message --- static/chat/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +});