From 34d2047ac33693631167e6fd3fc16aed5c986549 Mon Sep 17 00:00:00 2001 From: SOFe Date: Sun, 5 Nov 2017 18:40:47 +0800 Subject: [PATCH] A better error message for Server::getInstance() access on other threads --- src/pocketmine/Server.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index e586c49a9..3424c63bb 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1407,6 +1407,9 @@ class Server{ * @return Server */ public static function getInstance() : Server{ + if(self::$instance === null){ + throw new \RuntimeException("Attempt to retrieve Server instance outside server thread"); + } return self::$instance; }