Add null check

This commit is contained in:
Khushboo Verma
2024-01-29 18:47:14 +05:30
parent f4426d553c
commit 2f88320d4f
+2 -3
View File
@@ -637,9 +637,8 @@ App::init()
$denylist = App::getEnv('_APP_COUNTRIES_DENYLIST', '');
if (!empty($denylist)) {
$countries = explode(',', $denylist);
$record = $geodb->get($request->getIP());
$country = $record['country']['iso_code'];
$countryName = $record['country']['names']['en'];
$record = $geodb->get($request->getIP()) ?? [];
$country = $record['country']['iso_code'] ?? '';
if (in_array($country, $countries)) {
throw new Exception(Exception::GENERAL_REGION_ACCESS_DENIED);
}