]> git.ktnx.net Git - mobile-ledger.git/commitdiff
syncData(): refuse to do anything when not associated with an item
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 4 Mar 2021 21:24:59 +0000 (23:24 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 4 Mar 2021 21:24:59 +0000 (23:24 +0200)
this may hapen when the item is swiped out (and loses focus, which may
cause re-setting amount text)

app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java

index f60980fa652e1b770909ac3d36b89c46f5a0cea4..0e2c947517140719fa3d9934e7e5bca734ba6953 100644 (file)
@@ -480,6 +480,12 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
             return false;
         }
 
+        if (getAdapterPosition() < 0) {
+            // probably the row was swiped out
+            Logger.debug("new-trans", "Ignoring request to suncData(): adapter position negative");
+            return false;
+        }
+
         NewTransactionModel.Item item = getItem();
 
         syncingData = true;