mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Fix null pointer
This commit is contained in:
@@ -46,8 +46,8 @@ use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
* @property int $transaction_journal_id
|
||||
* @property string|null $description
|
||||
* @property int|null $transaction_currency_id
|
||||
* @property string|null $modified
|
||||
* @property string|null $modified_foreign
|
||||
* @property string|int|null $modified
|
||||
* @property string|int|null $modified_foreign
|
||||
* @property string $date
|
||||
* @property string $max_date
|
||||
* @property string $amount
|
||||
|
@@ -148,8 +148,7 @@ trait ModelInformation
|
||||
} catch (Throwable $e) {
|
||||
app('log')->debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
|
||||
app('log')->debug($e->getTraceAsString());
|
||||
$string = '';
|
||||
throw new FireflyException('Could not render trigger', 0, $e);
|
||||
throw new FireflyException(sprintf('Could not render trigger: %s', $e->getMessage()), 0, $e);
|
||||
}
|
||||
if ('' !== $string) {
|
||||
$result[] = $string;
|
||||
@@ -264,7 +263,7 @@ trait ModelInformation
|
||||
} catch (Throwable $e) {
|
||||
app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
|
||||
app('log')->debug($e->getTraceAsString());
|
||||
throw new FireflyException('Could not render trigger', 0, $e);
|
||||
throw new FireflyException(sprintf('Could not render trigger: %s', $e->getMessage()), 0, $e);
|
||||
}
|
||||
if ('' !== $string) {
|
||||
$result[] = $string;
|
||||
|
@@ -164,8 +164,8 @@ class Steam
|
||||
/** @var Transaction $entry */
|
||||
foreach ($set as $entry) {
|
||||
// normal amount and foreign amount
|
||||
$modified = (string) (null === $entry->modified ? '0' : $entry->modified);
|
||||
$foreignModified = (string) (null === $entry->modified_foreign ? '0' :$entry->modified_foreign);
|
||||
$modified = (string)(null === $entry->modified ? '0' : $entry->modified);
|
||||
$foreignModified = (string)(null === $entry->modified_foreign ? '0' : $entry->modified_foreign);
|
||||
$amount = '0';
|
||||
if ($currencyId === (int)$entry->transaction_currency_id || 0 === $currencyId) {
|
||||
// use normal amount:
|
||||
@@ -322,15 +322,15 @@ class Steam
|
||||
$balances[$format] = $currentBalance;
|
||||
|
||||
app('log')->debug(sprintf(
|
||||
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
|
||||
$format,
|
||||
$currency->code,
|
||||
$rate,
|
||||
$currency->code,
|
||||
$transaction['amount'],
|
||||
$native->code,
|
||||
$convertedAmount
|
||||
));
|
||||
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
|
||||
$format,
|
||||
$currency->code,
|
||||
$rate,
|
||||
$currency->code,
|
||||
$transaction['amount'],
|
||||
$native->code,
|
||||
$convertedAmount
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
@@ -361,14 +361,12 @@ class Steam
|
||||
$cache->addProperty($date);
|
||||
$cache->addProperty($native->id);
|
||||
if ($cache->has()) {
|
||||
// return $cache->get();
|
||||
return $cache->get();
|
||||
}
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$currency = $repository->getAccountCurrency($account);
|
||||
if (null === $currency) {
|
||||
throw new FireflyException('Cannot get converted account balance: no currency found for account.');
|
||||
}
|
||||
$currency = null === $currency ? \FireflyIII\Support\Facades\Amount::getDefaultCurrency() : $currency;
|
||||
if ($native->id === $currency->id) {
|
||||
return $this->balance($account, $date);
|
||||
}
|
||||
|
Reference in New Issue
Block a user