]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionModel.java
track more instances where currency may be null (and replace it with "")
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / new_transaction / NewTransactionModel.java
index b3e9eeb3c8b6b26d5a7be7b0aaa911fdb9cb9f92..cfe9c5d951d94604121e4f938606047bc0cedb86 100644 (file)
@@ -497,8 +497,8 @@ public class NewTransactionModel extends ViewModel {
         int negativeCount = 0;
         for (int i = 0; i < accounts.size(); i++) {
             LedgerTransactionAccount acc = accounts.get(i);
-            TransactionAccount item =
-                    new TransactionAccount(acc.getAccountName(), acc.getCurrency());
+            TransactionAccount item = new TransactionAccount(acc.getAccountName(),
+                    Misc.nullIsEmpty(acc.getCurrency()));
             newList.add(item);
 
             item.setAccountName(acc.getAccountName());
@@ -1067,6 +1067,7 @@ public class NewTransactionModel extends ViewModel {
         private String accountName;
         private String amountHint;
         private String comment;
+        @NotNull
         private String currency = "";
         private float amount;
         private boolean amountSet;
@@ -1091,7 +1092,7 @@ public class NewTransactionModel extends ViewModel {
         }
         public TransactionAccount(LedgerTransactionAccount account) {
             super();
-            currency = account.getCurrency();
+            currency = Misc.nullIsEmpty(account.getCurrency());
             amount = account.getAmount();
         }
         public TransactionAccount(String accountName) {
@@ -1175,6 +1176,7 @@ public class NewTransactionModel extends ViewModel {
         }
         @SuppressLint("DefaultLocale")
         @Override
+        @NotNull
         public String toString() {
             StringBuilder b = new StringBuilder();
             b.append(String.format("id:%d/%s", id, Integer.toHexString(hashCode())));