]> git.ktnx.net Git - mobile-ledger.git/commitdiff
stop parser if the task is cancelled
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 16 Dec 2018 13:12:17 +0000 (13:12 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 16 Dec 2018 13:12:17 +0000 (13:12 +0000)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java

index 1ef1ccade00e4d40cf93f266b6c3a1205b9e36a1..93132545d87dde15bb0dbdd1e5250b75212af25a 100644 (file)
@@ -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();