]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
when deleting the currently active profile, switch to the first profile
[mobile-ledger.git] / 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