1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Wait in Roster's presence listener until Roster is loaded

Fixes SMACK-681.
This commit is contained in:
Florian Schmaus 2015-07-03 14:24:13 +02:00
parent e6a403fb1c
commit 3bb06b8429

View file

@ -1180,6 +1180,13 @@ public class Roster extends Manager {
@Override @Override
public void processPacket(Stanza packet) throws NotConnectedException { public void processPacket(Stanza packet) throws NotConnectedException {
// Try to ensure that the roster is loaded when processing presence stanzas. While the
// presence listener is synchronous, the roster result listener is not, which means that
// the presence listener may be invoked with a not yet loaded roster.
boolean loaded = waitUntilLoaded();
if (loaded) {
LOGGER.warning("Roster not loaded while processing presence stanza");
}
final XMPPConnection connection = connection(); final XMPPConnection connection = connection();
Presence presence = (Presence) packet; Presence presence = (Presence) packet;
String from = presence.getFrom(); String from = presence.getFrom();