Handle edgecase when there are no buddies

This commit is contained in:
moyamo 2015-12-04 20:44:37 +02:00
parent 97c8cfed94
commit 7302c4fc2c

View file

@ -89,6 +89,7 @@ class WhatsAppBackend(SpectrumBackend):
"""Called when user logs in. Used to initialize roster.""" """Called when user logs in. Used to initialize roster."""
self.logger.debug("handleBuddies(buddies=%s)", buddies) self.logger.debug("handleBuddies(buddies=%s)", buddies)
buddies = [b for b in buddies.buddy] buddies = [b for b in buddies.buddy]
if len(buddies) > 0:
user = buddies[0].userName user = buddies[0].userName
self.sessions[user].loadBuddies(buddies) self.sessions[user].loadBuddies(buddies)