]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/Data.java
Data.setCurrentProfile: use setValue() instead of postValue()
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / Data.java
index 1b659ff7d866485d8874b1efcfadafc5d7084186..0bdbb1a229faa104af945fdab812ba4ad078ec45 100644 (file)
@@ -76,7 +76,7 @@ public final class Data {
     public static void setCurrentProfile(MobileLedgerProfile newProfile) {
         MLDB.setOption(MLDB.OPT_PROFILE_UUID, (newProfile == null) ? null : newProfile.getUuid());
         stopTransactionsRetrieval();
-        profile.postValue(newProfile);
+        profile.setValue(newProfile);
     }
     public static int getProfileIndex(MobileLedgerProfile profile) {
         try (LockHolder ignored = profilesLocker.lockForReading()) {
@@ -148,8 +148,10 @@ public final class Data {
             return;
         }
         MobileLedgerProfile pr = profile.getValue();
-        if (pr == null)
-            throw new IllegalStateException("No current profile");
+        if (pr == null) {
+            Logger.debug("ui", "Ignoring refresh -- no current profile");
+            return;
+        }
 
         retrieveTransactionsTask =
                 new RetrieveTransactionsTask(new WeakReference<>(activity), profile.getValue());