diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index d5f4cd950..abba3ffb0 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -238,10 +238,12 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface { $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 $adv; }