]> git.ktnx.net Git - mobile-ledger.git/commitdiff
when deleting the currently active profile, switch to the first profile
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 19 Apr 2021 20:07:17 +0000 (23:07 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 19 Apr 2021 20:07:17 +0000 (23:07 +0300)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index 945e81c51043d0865a80d0d83bb4344b1d22681d..7df18278515ab2d1c548cb1ee5288343d2c210f1 100644 (file)
@@ -383,6 +383,12 @@ public class MainActivity extends ProfileThemedActivity implements FabManager.Fa
         mProfileListAdapter.setProfileList(newList);
 
         createShortcuts(newList);
+
+        Profile currentProfile = Data.getProfile();
+        if (currentProfile == null || !newList.contains(currentProfile)) {
+            Logger.debug(TAG, "Switching profile because the current is no longer available");
+            Data.setCurrentProfile(newList.get(0));
+        }
     }
     /**
      * called when the current profile has changed