From 1688588d70ab1f75c0369080087af46958aacbbe Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 2 Feb 2021 08:00:49 +0200 Subject: [PATCH] guard against ncurrent navigation controller destination being null --- .../TemplatesActivity.java} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename app/src/main/java/net/ktnx/mobileledger/ui/{patterns/PatternsActivity.java => templates/TemplatesActivity.java} (95%) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplatesActivity.java similarity index 95% rename from app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java rename to app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplatesActivity.java index 945123d9..0f1d20f4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/templates/TemplatesActivity.java @@ -82,8 +82,9 @@ public class PatternsActivity extends CrashReportingActivity @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { - if (navController.getCurrentDestination() - .getId() == R.id.patternDetailsFragment) + final NavDestination currentDestination = navController.getCurrentDestination(); + if (currentDestination != null && + currentDestination.getId() == R.id.patternDetailsFragment) navController.popBackStack(); else finish(); -- 2.39.5