From 1b9686439630c1d91d76f3bdeb260a588cfd68a6 Mon Sep 17 00:00:00 2001 From: Javier Sanahuja Date: Wed, 14 Apr 2021 19:45:28 +0200 Subject: [PATCH] Fixed controller toggleResource issue --- src/Controller.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Controller.php b/src/Controller.php index 2015334..f2e54a7 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -88,7 +88,10 @@ public function message($client, $message){ public function toggleResource($client, $resource){ if($client->toggleResource($resource)){ - $client->getRoom()->getSocket($this->io)->emit("r_resource", $client->getPublicInfo(), $client->getResources()); + $room = $client->getRoom(); + if($room !== false){ + $room->getSocket($this->io)->emit("r_resource", $client->getPublicInfo(), $client->getResources()); + } } }