-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
Fix random crashes when saving transactions Closes #431
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -785,8 +785,8 @@ private void saveNewTransaction() { | |
mTransaction.addSplit(split); | ||
|
||
String transferAcctUID; | ||
if (mUseDoubleEntry) { | ||
long transferAcctId = mTransferAccountSpinner.getSelectedItemId(); | ||
long transferAcctId = mTransferAccountSpinner.getSelectedItemId(); | ||
if (mUseDoubleEntry || transferAcctId < 0) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
codinguser
via email
Author
Owner
|
||
transferAcctUID = mAccountsDbAdapter.getUID(transferAcctId); | ||
} else { | ||
transferAcctUID = mAccountsDbAdapter.getOrCreateImbalanceAccountUID(currency); | ||
|
Hi @codinguser! I've arrived here from this crash report. It seems lots crashes go through this code path.
I was trying to understand the condition under which the application crashes, but I got confused with the change in the conditional. Could you explain it? For me, it would make more sense something like this:
Even so, I still doubt about this.
getSelectedItemId()
should only returnINVALID_ROW_ID
if nothing has been selected in the spinner. However, if it has items, I don't see any way to arrive at this condition. I'd say it could only happen in the case the spinner was empty but, again, I'm not sure it's possible with a sensible accounts structure.What do you think?