From b41ddec68233d6f45d2cf1476c8b9e8772cbbc05 Mon Sep 17 00:00:00 2001 From: Belle Aerni Date: Fri, 27 Dec 2024 02:59:29 -0800 Subject: [PATCH] Slight geoip reader fixes (#2559) Small changes to avoid error generation --- src/library/FOSSBilling/GeoIP/Country.php | 4 ++-- src/library/FOSSBilling/GeoIP/Reader.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/library/FOSSBilling/GeoIP/Country.php b/src/library/FOSSBilling/GeoIP/Country.php index 6d379de4f..fc1739951 100644 --- a/src/library/FOSSBilling/GeoIP/Country.php +++ b/src/library/FOSSBilling/GeoIP/Country.php @@ -40,8 +40,8 @@ class Country implements \JsonSerializable // Instance the language $country = CountryAlpha2::from($countyRecord['iso_code']); - $this->name = $country->getNameInLanguage($language); - $this->flag = $country->getFlagEmoji(); + $this->name = $country->getNameInLanguage($language) ?? 'Unknown'; + $this->flag = $country->getFlagEmoji() ?? ''; foreach ($country->getCurrenciesAlpha3() as $currency) { $currencies[] = $currency->value; diff --git a/src/library/FOSSBilling/GeoIP/Reader.php b/src/library/FOSSBilling/GeoIP/Reader.php index 746cb3e85..b437f90b3 100644 --- a/src/library/FOSSBilling/GeoIP/Reader.php +++ b/src/library/FOSSBilling/GeoIP/Reader.php @@ -55,7 +55,7 @@ class Reader */ public function get(string $ipAddress) { - return $this->reader->get($ipAddress); + return $this->reader->get($ipAddress) ?? []; } /**