From: Damyan Ivanov Date: Sun, 16 Dec 2018 13:12:17 +0000 (+0000) Subject: stop parser if the task is cancelled X-Git-Tag: v0.3~216 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=0699ca1aaa0980079482d7479fabc4b159c9cc6f;p=mobile-ledger.git stop parser if the task is cancelled --- 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();