Catch null in currency pref. [skip ci]

This commit is contained in:
James Cole
2018-04-08 16:21:17 +02:00
parent 5850ad06b1
commit b561e79a6c

View File

@@ -439,13 +439,14 @@ class AccountController extends Controller
/** @var CurrencyRepositoryInterface $repository */ /** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class); $repository = app(CurrencyRepositoryInterface::class);
$chartData = []; $default = app('amount')->getDefaultCurrency();
$chartData = [];
foreach ($accounts as $account) { foreach ($accounts as $account) {
Log::debug(sprintf('Now at account #%d', $account->id)); $currency = $repository->findNull((int)$account->getMeta('currency_id'));
Log::debug(sprintf('Currency preference is: %d', (int)$account->getMeta('currency_id'))); if (null === $currency) {
$currency = $repository->findNull((int)$account->getMeta('currency_id')); $currency = $default;
Log::debug(sprintf('Currency is null? %s', var_export($currency === null, true))); }
$currentSet = [ $currentSet = [
'label' => $account->name, 'label' => $account->name,
'currency_symbol' => $currency->symbol, 'currency_symbol' => $currency->symbol,
'entries' => [], 'entries' => [],