Catch NULL.

This commit is contained in:
James Cole
2025-08-07 05:56:31 +02:00
parent 4f1f360346
commit e300314e05

View File

@@ -102,11 +102,11 @@ class PiggyBankEnrichment implements EnrichmentInterface
if (!array_key_exists($accountId, $this->amounts[$id])) { if (!array_key_exists($accountId, $this->amounts[$id])) {
$this->amounts[$id][$accountId] = [ $this->amounts[$id][$accountId] = [
'current_amount' => '0', 'current_amount' => '0',
'pc_current_amount' => '0', 'pc_current_amount' => null,
]; ];
} }
$this->amounts[$id][$accountId]['current_amount'] = bcadd($this->amounts[$id][$accountId]['current_amount'], $item->current_amount); $this->amounts[$id][$accountId]['current_amount'] = bcadd($this->amounts[$id][$accountId]['current_amount'], $item->current_amount);
if (null !== $this->amounts[$id][$accountId]['pc_current_amount']) { if (null !== $this->amounts[$id][$accountId]['pc_current_amount'] && null !== $item->native_current_amount) {
$this->amounts[$id][$accountId]['pc_current_amount'] = bcadd($this->amounts[$id][$accountId]['pc_current_amount'], $item->native_current_amount); $this->amounts[$id][$accountId]['pc_current_amount'] = bcadd($this->amounts[$id][$accountId]['pc_current_amount'], $item->native_current_amount);
} }
} }