From: Darren Date: Sun, 26 Aug 2012 20:50:46 +0000 (+0100) Subject: Error handling in Member/Panel collection getBy* methods X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0f86ab2cc85eee9d210a51d929ccc93d6ac293cc;p=KiwiIRC.git Error handling in Member/Panel collection getBy* methods --- diff --git a/client_backbone/model.js b/client_backbone/model.js index e1eb0bd..9432844 100644 --- a/client_backbone/model.js +++ b/client_backbone/model.js @@ -56,6 +56,7 @@ kiwi.model.MemberList = Backbone.Collection.extend({ }, getByNick: function (nick) { return this.find(function (m) { + if (typeof m !== 'string') return; return nick.toLowerCase() === m.get('nick').toLowerCase(); }); } @@ -178,6 +179,7 @@ kiwi.model.PanelList = Backbone.Collection.extend({ }, getByName: function (name) { return this.find(function (c) { + if (typeof c !== 'string') return; return name.toLowerCase() === c.get('name').toLowerCase(); }); }