diff --git a/extensions/flags/src/Listener/AddPostFlagsRelationship.php b/extensions/flags/src/Listener/AddPostFlagsRelationship.php index e0d2c5b8c..62b2d9fb7 100755 --- a/extensions/flags/src/Listener/AddPostFlagsRelationship.php +++ b/extensions/flags/src/Listener/AddPostFlagsRelationship.php @@ -100,7 +100,9 @@ class AddPostFlagsRelationship // models) so that we can selectively expose only the flags that the // user has permission to view. if ($event->isController(Controller\ShowDiscussionController::class)) { - $posts = $event->data->getRelation('posts'); + if ($event->data->relationLoaded('posts')) { + $posts = $event->data->getRelation('posts'); + } } if ($event->isController(Controller\ListPostsController::class)) {