mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #9789
This commit is contained in:
parent
a977c567ce
commit
4eb3ce7c14
@ -26,6 +26,8 @@ namespace FireflyIII\Support\Twig;
|
||||
use FireflyIII\Models\Account as AccountModel;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
@ -114,6 +116,11 @@ class AmountFormat extends AbstractExtension
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
$currency = TransactionCurrency::whereCode($code)->first();
|
||||
if(null === $currency) {
|
||||
Log::error(sprintf('Could not find currency with code "%s". Fallback to native currency.', $code));
|
||||
$currency = Amount::getNativeCurrency();
|
||||
Log::error(sprintf('Fallback currency is "%s".', $currency->code));
|
||||
}
|
||||
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user