VKAPI: Fix 500 error if some peers_id is invalid

This commit is contained in:
veselcraft 2022-10-22 16:52:19 +03:00
parent ca27e0588a
commit c3610cdd4d
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -247,6 +247,7 @@ final class Messages extends VKAPIRequestHandler
$user = (new USRRepo)->get((int) $peer); $user = (new USRRepo)->get((int) $peer);
if($user) {
$dialogue = new Correspondence($this->getUser(), $user); $dialogue = new Correspondence($this->getUser(), $user);
$iterator = $dialogue->getMessages(Correspondence::CAP_BEHAVIOUR_START_MESSAGE_ID, 0, 1, 0, false); $iterator = $dialogue->getMessages(Correspondence::CAP_BEHAVIOUR_START_MESSAGE_ID, 0, 1, 0, false);
$msg = $iterator[0]->unwrap(); // шоб удобнее было $msg = $iterator[0]->unwrap(); // шоб удобнее было
@ -274,6 +275,7 @@ final class Messages extends VKAPIRequestHandler
]; ];
$userslist[] = $user->getId(); $userslist[] = $user->getId();
} }
}
if($extended == 1) { if($extended == 1) {
$userslist = array_unique($userslist); $userslist = array_unique($userslist);