From 092c9b9f29b510cdf190c2f14384d1af3a408668 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 24 Dec 2022 23:58:00 +0100 Subject: [PATCH] be more defensive about array index --- Utils/Converter/Currency.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Utils/Converter/Currency.php b/Utils/Converter/Currency.php index 6cbaaeb46..6a8b1bb7b 100755 --- a/Utils/Converter/Currency.php +++ b/Utils/Converter/Currency.php @@ -115,7 +115,12 @@ final class Currency self::$ecbCurrencies = []; foreach ($node as $key => $value) { - self::$ecbCurrencies[\strtoupper((string) $value->attributes()['currency'])] = (float) $value->attributes()['rate']; + /** @var null|array $attributes */ + if (($attributes = $value->attributes()) === null) { + continue; + } + + self::$ecbCurrencies[\strtoupper((string) ($attributes['currency']))] = (float) ($attributes['rate']); } } catch (\Throwable $t) { self::$ecbCurrencies = []; // @codeCoverageIgnore