From c1278f2615c53957fae624e2072d6119948a8621 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 15 Apr 2024 01:20:05 +0900 Subject: [PATCH] Fix error when saved value is not a valid country code --- modules/extravar/models/Value.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/extravar/models/Value.php b/modules/extravar/models/Value.php index 84c2b1fd1..47f448859 100644 --- a/modules/extravar/models/Value.php +++ b/modules/extravar/models/Value.php @@ -260,9 +260,16 @@ class Value case 'kr_zip': return is_array($value) ? implode(' ', $value) : $value; case 'country': - $country = i18n::listCountries()[$value]; - $lang_type = \Context::getLangType(); - return $lang_type === 'ko' ? $country->name_korean : $country->name_english; + $country = i18n::listCountries()[$value] ?? ''; + if ($country) + { + $lang_type = \Context::getLangType(); + return $lang_type === 'ko' ? $country->name_korean : $country->name_english; + } + else + { + return ''; + } case 'language': return Lang::getSupportedList()[$value]['name'] ?? ''; case 'date':