Skip to content

Commit 33f80f2

Browse files
author
Grigory Fedorov
committed
request roster reload only if account connected and authorized.
1 parent fe70aef commit 33f80f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

xabber/src/main/java/com/xabber/android/data/roster/RosterManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.xabber.android.data.account.listeners.OnAccountEnabledListener;
2929
import com.xabber.android.data.connection.ConnectionItem;
3030
import com.xabber.android.data.connection.ConnectionManager;
31+
import com.xabber.android.data.connection.ConnectionState;
3132
import com.xabber.android.data.connection.ConnectionThread;
3233
import com.xabber.android.data.connection.listeners.OnDisconnectListener;
3334
import com.xabber.android.data.entity.BaseEntity;
@@ -128,7 +129,8 @@ public Collection<RosterContact> getContacts() {
128129
private void requestRosterReloadIfNeeded() {
129130
for (String account : AccountManager.getInstance().getAccounts()) {
130131
final Roster roster = RosterManager.getInstance().getRoster(account);
131-
if (roster != null && !roster.isLoaded()) {
132+
if (roster != null && !roster.isLoaded()
133+
&& AccountManager.getInstance().getAccount(account).getState() == ConnectionState.connected) {
132134
try {
133135
roster.reload();
134136
} catch (SmackException.NotLoggedInException | SmackException.NotConnectedException e) {

0 commit comments

Comments
 (0)