1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Prevent crash

This commit is contained in:
M66B 2021-09-30 07:24:59 +02:00
parent 2ec84d6c5a
commit 7d53bf3d80

View file

@ -1415,7 +1415,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
selectionTracker.addObserver(new SelectionTracker.SelectionObserver<Long>() {
@Override
public void onSelectionChanged() {
if (!getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;
FragmentActivity activity = getActivity();
@ -1427,7 +1427,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onItemStateChanged(@NonNull Long key, boolean selected) {
if (!getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;
int pos = adapter.getPositionForKey(key);
@ -1473,6 +1473,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public boolean isInAbsoluteEnd() {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return false;
PagedList<TupleMessageEx> list = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList();
if (list == null)
return false;
@ -5271,9 +5274,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Context context = getContext();
if (context == null)
return;
if (getView() == null)
return;
if (!getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);