From d6d5e82bec8dda151cf4bd18c907ddc1f6f770f2 Mon Sep 17 00:00:00 2001 From: pokkst Date: Sat, 17 Sep 2022 17:53:32 -0500 Subject: [PATCH] fix concurrent modification exception --- .../java/net/mynero/wallet/service/AddressService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/mynero/wallet/service/AddressService.java b/app/src/main/java/net/mynero/wallet/service/AddressService.java index f8ed988..5176b89 100644 --- a/app/src/main/java/net/mynero/wallet/service/AddressService.java +++ b/app/src/main/java/net/mynero/wallet/service/AddressService.java @@ -5,6 +5,10 @@ import net.mynero.wallet.model.TransactionInfo; import net.mynero.wallet.model.Wallet; import net.mynero.wallet.model.WalletManager; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + public class AddressService extends ServiceBase { public static AddressService instance = null; private int latestAddressIndex = 1; @@ -19,7 +23,8 @@ public class AddressService extends ServiceBase { } public void refreshAddresses() { - for (TransactionInfo info : HistoryService.getInstance().getHistory()) { + List localTransactionList = new ArrayList<>(HistoryService.getInstance().getHistory()); + for (TransactionInfo info : localTransactionList) { if (info.addressIndex >= latestAddressIndex) { latestAddressIndex = info.addressIndex + 1; }