Skip to content

Commit 57241e8

Browse files
committed
Fix crash when scheduled service does not find transaction
Fix crash when closing Accounts list Update CHANGELOG for v2.2.2
1 parent a3927c8 commit 57241e8

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Change Log
22
===============================================================================
3+
Version 2.1.1 *(2016-09-05)*
4+
----------------------------
5+
* Fixed: Bug cause crash during start-up for devices with no scheduled transactions
6+
37
Version 2.1.0 *(2016-09-01)*
48
----------------------------
59
* Feature: Use multiple GnuCash books in single application
@@ -15,7 +19,9 @@ Version 2.1.0 *(2016-09-01)*
1519
Version 2.0.7 *(2016-05-05)*
1620
----------------------------
1721
* Fixed: Currency exchange rate does not accept very small rates (> 2 decimal places)
18-
* Improved: Updated translations for Japanese, Polish, French, Version 2.0.6 *(2016-02-20)*
22+
* Improved: Updated translations for Japanese, Polish, French,
23+
24+
Version 2.0.6 *(2016-02-20)*
1925
----------------------------
2026
* Fixed: Saving transaction gets slower with increase in size of database
2127
* Fixed: Imbalance amount wrongly computed in split editor (for some accounts)

app/src/main/java/org/gnucash/android/service/ScheduledActionService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ private static int executeTransactions(ScheduledAction scheduledAction, SQLiteDa
187187
int executionCount = 0;
188188
String actionUID = scheduledAction.getActionUID();
189189
TransactionsDbAdapter transactionsDbAdapter = new TransactionsDbAdapter(db, new SplitsDbAdapter(db));
190-
Transaction trxnTemplate = transactionsDbAdapter.getRecord(actionUID);
190+
Transaction trxnTemplate = null;
191+
try {
192+
trxnTemplate = transactionsDbAdapter.getRecord(actionUID);
193+
} catch (IllegalArgumentException ex){ //if the record could not be found, abort
194+
return executionCount;
195+
}
196+
191197

192198
long now = System.currentTimeMillis();
193199
//if there is an end time in the past, we execute all schedules up to the end time.

app/src/main/java/org/gnucash/android/ui/account/AccountsListFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ public void onSaveInstanceState(Bundle outState) {
318318
@Override
319319
public void onDestroy() {
320320
super.onDestroy();
321-
mAccountRecyclerAdapter.swapCursor(null);
321+
if (mAccountRecyclerAdapter != null)
322+
mAccountRecyclerAdapter.swapCursor(null);
322323
}
323324

324325
/**

0 commit comments

Comments
 (0)