VKAPI: Fix 500 error if the post is published as anon

This commit is contained in:
veselcraft 2022-03-25 14:44:10 +03:00
parent 514b73d41e
commit 4bf6fce260
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@ final class Wall extends VKAPIRequestHandler
$attachments[] = [
"type" => "photo",
"photo" => [
"album_id" => $attachment->getAlbum()->getId(),
"album_id" => $attachment->getAlbum() ? $attachment->getAlbum()->getId() : null,
"date" => $attachment->getPublicationTime()->timestamp(),
"id" => $attachment->getVirtualId(),
"owner_id" => $attachment->getOwner()->getId(),

View file

@ -121,6 +121,6 @@ class Albums
{
$dbalbum = DatabaseConnection::i()->getContext()->table("album_relations")->where(["media" => $photo->getId()])->fetch();
return $this->get($dbalbum->collection);
return $dbalbum->collection ? $this->get($dbalbum->collection) : null;
}
}