From ad66a92deb71f5dd9e54b8c486a3e69a2fc3b12d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 9 Jul 2020 15:06:50 -0400 Subject: [PATCH] Add check for $a->profile structure in Module\HoverCard --- src/Module/HoverCard.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Module/HoverCard.php b/src/Module/HoverCard.php index f3b8248a6..ae107ca17 100644 --- a/src/Module/HoverCard.php +++ b/src/Module/HoverCard.php @@ -26,7 +26,7 @@ use Friendica\Core\Session; use Friendica\DI; use Friendica\Model\Profile; use Friendica\Model\User; -use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Network\HTTPException; /** * Loads a profile for the HoverCard view @@ -44,11 +44,15 @@ class HoverCard extends BaseModule // Show the profile hovercard $nickname = $parameters['profile']; } else { - throw new NotFoundException(DI::l10n()->t('No profile')); + throw new HTTPException\NotFoundException(DI::l10n()->t('No profile')); } Profile::load($a, $nickname); + if (empty($a->profile)) { + throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); + } + $page = DI::page(); if (!empty($a->profile['page-flags']) && ($a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) {