]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java
two fallouts after transaction date reorganisation and 'go to date' feature
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / LedgerTransaction.java
index 9b73d2ce9d1c9d477c77fe70f83bcdb0ee126aeb..04b63b64169f03b11ac0ab7e747abfab51a17431 100644 (file)
@@ -20,6 +20,10 @@ package net.ktnx.mobileledger.model;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.ktnx.mobileledger.App;
 import net.ktnx.mobileledger.utils.Digest;
 import net.ktnx.mobileledger.utils.Globals;
 import net.ktnx.mobileledger.utils.SimpleDate;
@@ -98,7 +102,15 @@ public class LedgerTransaction {
         accounts.add(item);
         dataHash = null;
     }
+    @Nullable
+    public SimpleDate getDateIfAny() {
+        return date;
+    }
+    @NonNull
     public SimpleDate getDate() {
+        loadData(App.getDatabase());
+        if (date == null)
+            throw new IllegalStateException("Transaction has no date");
         return date;
     }
     public void setDate(SimpleDate date) {