Merge pull request #10612 from MrPetovan/bug/fatal-errors

Various Fatal error fixes
This commit is contained in:
Michael Vogel 2021-08-17 17:34:27 +02:00 committed by GitHub
commit 4d25825482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -65,6 +65,9 @@ function photos_init(App $a) {
if (DI::args()->getArgc() > 1) { if (DI::args()->getArgc() > 1) {
$owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]); $owner = User::getOwnerDataByNick(DI::args()->getArgv()[1]);
if (!$owner) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
$is_owner = (local_user() && (local_user() == $owner['uid'])); $is_owner = (local_user() && (local_user() == $owner['uid']));

View File

@ -32,6 +32,7 @@ use Friendica\Core\System;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\HTTPException;
use Friendica\Network\Probe; use Friendica\Network\Probe;
/** /**
@ -44,6 +45,9 @@ class RemoteFollow extends BaseModule
public static function init(array $parameters = []) public static function init(array $parameters = [])
{ {
self::$owner = User::getOwnerDataByNick($parameters['profile']); self::$owner = User::getOwnerDataByNick($parameters['profile']);
if (!self::$owner) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
DI::page()['aside'] = Widget\VCard::getHTML(self::$owner); DI::page()['aside'] = Widget\VCard::getHTML(self::$owner);
} }

View File

@ -2167,7 +2167,7 @@ class Probe
{ {
// Search for the newest entry in the feed // Search for the newest entry in the feed
$curlResult = DI::httpRequest()->get($data['poll']); $curlResult = DI::httpRequest()->get($data['poll']);
if (!$curlResult->isSuccess()) { if (!$curlResult->isSuccess() || !$curlResult->getBody()) {
return ''; return '';
} }