]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionFragment.java
fix crash in new transaction shortcut when the main app is not running
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / new_transaction / NewTransactionFragment.java
index 7741d18ac6656902485662583ba02d924078761c..60fd3cbabd91afc6213c7ee8ddfcde39dea89bcc 100644 (file)
@@ -195,8 +195,13 @@ public class NewTransactionFragment extends Fragment {
             element = FocusedElement.valueOf(savedInstanceState.getString("focused-element"));
         }
 
-        if (!keep)
-            viewModel.reset();
+        if (!keep) {
+            // we need the DB up and running
+            Data.observeProfile(getViewLifecycleOwner(), p -> {
+                if (p != null)
+                    viewModel.reset();
+            });
+        }
         else {
             viewModel.noteFocusChanged(focused, element);
         }