Prevent crash

This commit is contained in:
M66B
2018-08-17 05:34:46 +00:00
parent ff12eaf0fb
commit d012567435
3 changed files with 9 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ import android.view.MenuItem;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
public class ActivityCompose extends ActivityBase implements FragmentManager.OnBackStackChangedListener {
static final int REQUEST_CONTACT_TO = 1;
@@ -54,7 +55,8 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
getSupportFragmentManager().popBackStack();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getSupportFragmentManager().popBackStack();
return true;
}
return super.onOptionsItemSelected(item);