From f8c9d2402907f23e2423b4c889e70a267d46b86a Mon Sep 17 00:00:00 2001 From: Heath Corbin Date: Wed, 24 Aug 2016 10:25:21 -0500 Subject: [PATCH] Fixed instance where items are null and exception is thrown if the roster has not been retrieved --- roster/strophe.roster.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/roster/strophe.roster.js b/roster/strophe.roster.js index 67e3b99..9f63ed1 100755 --- a/roster/strophe.roster.js +++ b/roster/strophe.roster.js @@ -160,13 +160,16 @@ Strophe.addConnectionPlugin('roster', */ findItem : function(jid) { - for (var i = 0; i < this.items.length; i++) - { - if (this.items[i] && this.items[i].jid == jid) - { - return this.items[i]; - } - } + if(this.items) + { + for (var i = 0; i < this.items.length; i++) + { + if (this.items[i] && this.items[i].jid == jid) + { + return this.items[i]; + } + } + } return false; }, /** Function: removeItem