From 0699ca1aaa0980079482d7479fabc4b159c9cc6f Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 16 Dec 2018 13:12:17 +0000 Subject: [PATCH] stop parser if the task is cancelled --- .../net/ktnx/mobileledger/async/RetrieveTransactionsTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java index 1ef1ccad..93132545 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -114,6 +114,7 @@ public class RetrieveTransactionsTask extends LedgerTransaction transaction = null; LINES: while ((line = buf.readLine()) != null) { + if (isCancelled()) break; if (!line.isEmpty() && (line.charAt(0) == ' ')) continue; Matcher m; L(String.format("State is %d", state)); @@ -198,7 +199,7 @@ public class RetrieveTransactionsTask extends state)); } } - db.setTransactionSuccessful(); + if (!isCancelled()) db.setTransactionSuccessful(); } finally { db.endTransaction(); -- 2.39.5