Error handling in Member/Panel collection getBy* methods
authorDarren <darren@darrenwhitlen.com>
Sun, 26 Aug 2012 20:50:46 +0000 (21:50 +0100)
committerDarren <darren@darrenwhitlen.com>
Sun, 26 Aug 2012 20:50:46 +0000 (21:50 +0100)
client_backbone/model.js

index e1eb0bd0fddcb09e3a0e69625b5a303113208b24..9432844761ec2ef1caf8cf72fae2223e5836a496 100644 (file)
@@ -56,6 +56,7 @@ kiwi.model.MemberList = Backbone.Collection.extend({
     },\r
     getByNick: function (nick) {\r
         return this.find(function (m) {\r
+            if (typeof m !== 'string') return;\r
             return nick.toLowerCase() === m.get('nick').toLowerCase();\r
         });\r
     }\r
@@ -178,6 +179,7 @@ kiwi.model.PanelList = Backbone.Collection.extend({
     },\r
     getByName: function (name) {\r
         return this.find(function (c) {\r
+            if (typeof c !== 'string') return;\r
             return name.toLowerCase() === c.get('name').toLowerCase();\r
         });\r
     }\r