diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index 7a40a7665..eb9abab5d 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -193,10 +193,13 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface $country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first(); $city = CityModel::query()->where('location_cities.id', $adv->city)->first(); - $adv->setAttribute('country_name', $country->name); - $adv->setAttribute('city_name', $city->name); + if($country != null) { + $adv->setAttribute('country_name', $country->name); + } + if($city != null) { + $adv->setAttribute('city_name', $city->name); + } } - return $advs; }