From 32ba532bc7009507c192abef515545d8c1ce94a9 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sat, 13 Dec 2014 16:15:41 +0100 Subject: [PATCH] Throw an IllegalLinkException if room is null in UserAction --- file/lib/data/user/UserAction.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/file/lib/data/user/UserAction.class.php b/file/lib/data/user/UserAction.class.php index 64857dd..91cc035 100644 --- a/file/lib/data/user/UserAction.class.php +++ b/file/lib/data/user/UserAction.class.php @@ -27,7 +27,8 @@ public function validatePrepareInvite() { $room = \chat\data\room\RoomCache::getInstance()->getRoom(WCF::getUser()->chatRoomID); - if (!$room || !$room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException(); + if ($room === null) throw new \wcf\system\exception\IllegalLinkException(); + if (!$room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException(); } /** @@ -62,7 +63,8 @@ public function validateInvite() { $this->room = \chat\data\room\RoomCache::getInstance()->getRoom(WCF::getUser()->chatRoomID); - if (!$this->room || !$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException(); + if ($this->room === null) throw new \wcf\system\exception\IllegalLinkException(); + if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException(); if (!isset($this->parameters['recipients'])) throw new \wcf\system\exception\UserInputException("recipients"); }