Skip to content

Commit

Permalink
Merge pull request #110 from hacorbin/master
Browse files Browse the repository at this point in the history
Fixed instance where items are null and exception is thrown if the ro…
  • Loading branch information
jcbrand authored Aug 24, 2016
2 parents 254d08a + f8c9d24 commit 8877b7f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions roster/strophe.roster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8877b7f

Please # to comment.