Fixed lifecycle crashes

This commit is contained in:
M66B
2018-08-21 13:13:17 +00:00
parent 0fcaad281d
commit 8b7bc70c9e
5 changed files with 14 additions and 5 deletions

View File

@@ -76,6 +76,7 @@ import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.cursoradapter.widget.SimpleCursorAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -799,7 +800,8 @@ public class FragmentCompose extends FragmentEx {
public void onChanged(final EntityMessage draft) {
// Draft was deleted
if (draft == null || draft.ui_hide) {
getFragmentManager().popBackStack();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack();
return;
}
}