1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +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
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();
Presence presence = (Presence) packet;
String from = presence.getFrom();