VKAPI: Change Friends.get behaviour if user not found

This commit is contained in:
veselcraft 2023-10-28 13:24:32 +03:00
parent cd7b51fcf6
commit 15a5f172d9
No known key found for this signature in database
GPG key ID: 9CF0B42766CCF7BA

View file

@ -13,6 +13,10 @@ final class Friends extends VKAPIRequestHandler
$users = new UsersRepo; $users = new UsersRepo;
$this->requireUser(); $this->requireUser();
if (is_null($users->get($user_id))) {
$this->fail(100, "One of the parameters specified was missing or invalid");
}
foreach($users->get($user_id)->getFriends($offset, $count) as $friend) { foreach($users->get($user_id)->getFriends($offset, $count) as $friend) {
$friends[$i] = $friend->getId(); $friends[$i] = $friend->getId();