Prevent crash

This commit is contained in:
M66B 2018-12-28 08:15:58 +00:00
parent d034dc93e8
commit 7e7ccfa9b5
1 changed files with 13 additions and 12 deletions

View File

@ -429,21 +429,22 @@ public class FragmentMessages extends FragmentEx {
selectionTracker.addObserver(new SelectionTracker.SelectionObserver() {
@Override
public void onSelectionChanged() {
if (selectionTracker.hasSelection()) {
swipeRefresh.setEnabled(false);
if (messages != null)
messages.removeObservers(getViewLifecycleOwner());
fabMore.show();
} else {
predicate.clearAccount();
fabMore.hide();
try {
try {
if (selectionTracker.hasSelection()) {
swipeRefresh.setEnabled(false);
if (getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
if (messages != null)
messages.removeObservers(getViewLifecycleOwner());
fabMore.show();
} else {
predicate.clearAccount();
fabMore.hide();
if (getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
loadMessages();
} catch (IllegalStateException ex) {
Log.w(ex);
swipeRefresh.setEnabled(true);
}
swipeRefresh.setEnabled(true);
} catch (IllegalStateException ex) {
Log.w(ex);
}
}
});