diff --git a/src/Api/AttachRelation.php b/src/Api/AttachRelation.php index b8d50e0..f94b523 100644 --- a/src/Api/AttachRelation.php +++ b/src/Api/AttachRelation.php @@ -35,7 +35,7 @@ public function __invoke(PostSerializer $serializer, Post $post): ?Relationship $viewCountry = $serializer->getActor()->can('fof-geoip.canSeeCountry'); $showFlagsFeatureEnabled = $this->settings->get('fof-geoip.showFlag'); - $userPreference = $post->user->getPreference('showIPCountry'); + $userPreference = $post->user?->getPreference('showIPCountry'); if ($viewCountry || ($showFlagsFeatureEnabled && $userPreference)) { return $serializer->hasOne($post, BasicIPInfoSerializer::class, 'ip_info');