avoid NullPointerException (#2013)

This commit is contained in:
Asiel Díaz Benítez
2021-08-04 09:05:33 -04:00
committed by GitHub
parent 3d3b1cc03f
commit 9be90a589e
@@ -418,7 +418,14 @@ public class ConversationListFragment extends Fragment
} else {
listflags |= DcContext.DC_GCL_ADD_ALLDONE_HINT;
}
DcChatlist chatlist = DcHelper.getContext(getContext()).getChatlist(listflags, queryFilter.isEmpty() ? null : queryFilter, 0);
Context context = getContext();
if (context == null) {
// can't load chat list at this time, see: https://github.com/deltachat/deltachat-android/issues/2012
Log.w(TAG, "Ignoring call to loadChatlist()");
return;
}
DcChatlist chatlist = DcHelper.getContext(context).getChatlist(listflags, queryFilter.isEmpty() ? null : queryFilter, 0);
Util.runOnMain(() -> {
if (chatlist.getCnt() <= 0 && TextUtils.isEmpty(queryFilter)) {