Avoid crash in Transactions' FilterOptionsDialog.

- This crash was being caused when the user tried to filter the transactions in the Transactions screen, but the user has no balances (existent or downloaded). The app was not prepared to handle that case.
master
Severiano Jaramillo 2019-08-21 17:48:51 -05:00
parent 31073e2acf
commit 1e75e369dc
1 changed files with 7 additions and 1 deletions

View File

@ -236,7 +236,13 @@ class FilterOptionsDialog : DialogFragment(), DatePickerFragment.OnDateSetListen
mFilterOptions.assetAll = cbAsset.isChecked
mFilterOptions.asset = (sAsset.selectedItem as BalanceDetail).symbol
val symbol = (sAsset.selectedItem as BalanceDetail?)?.symbol
// If there are no assets in the spinner (the account has 0 balances or the app has not yet
// fetched the account balances) symbol will be null, make sure that does not create a crash.
if (symbol != null)
mFilterOptions.asset = symbol
else
mFilterOptions.assetAll = true
mFilterOptions.equivalentValueAll = cbEquivalentValue.isChecked