From 613d12ca6bbf4496182c7242a4fa461b7cf89d2b Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Wed, 22 May 2013 23:37:14 -0500 Subject: [PATCH] Fix crash when watching battles before formats loaded --- js/client-mainmenu.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/client-mainmenu.js b/js/client-mainmenu.js index 6356e6f7c..b1a108439 100644 --- a/js/client-mainmenu.js +++ b/js/client-mainmenu.js @@ -470,6 +470,7 @@ // buttons search: function(i, button) { + if (!window.BattleFormats) return; this.requestNotifications(); var $searchForm = $(button).closest('form'); if ($searchForm.find('.cancel').length) { @@ -644,10 +645,12 @@ var buf = '

'; buf += '

'; @@ -656,6 +659,7 @@ this.$el.html(buf); this.$list = this.$('.list'); + app.on('init:formats', this.initialize, this); app.on('response:roomlist', this.update, this); app.send('/cmd roomlist'); this.update();