From: Damyan Ivanov Date: Thu, 4 Mar 2021 21:24:59 +0000 (+0200) Subject: syncData(): refuse to do anything when not associated with an item X-Git-Tag: v0.17.0~27 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=45616458ebcb6f3eed1c530f9b6d2d1d598ab8e0;p=mobile-ledger.git 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) --- 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;