From 45616458ebcb6f3eed1c530f9b6d2d1d598ab8e0 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 4 Mar 2021 23:24:59 +0200 Subject: [PATCH] syncData(): refuse to do anything when not associated with an item this may hapen when the item is swiped out (and loses focus, which may cause re-setting amount text) --- .../ui/new_transaction/NewTransactionItemHolder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java index f60980fa..0e2c9475 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionItemHolder.java @@ -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; -- 2.39.5