From d83820477fe905a85a4d1fd11bad1dba211f0f4f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 21 Dec 2019 13:17:25 +0000 Subject: [PATCH] TimingsHandler: throw on attempt to stop timer that is not running I do not think that this bug is in effect in the core code, but I can't be sure. --- src/pocketmine/timings/TimingsHandler.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/timings/TimingsHandler.php b/src/pocketmine/timings/TimingsHandler.php index 87a6100c55..b153a78dac 100644 --- a/src/pocketmine/timings/TimingsHandler.php +++ b/src/pocketmine/timings/TimingsHandler.php @@ -168,6 +168,9 @@ class TimingsHandler{ public function stopTiming(){ if(self::$enabled){ + if($this->timingDepth === 0){ + throw new \InvalidStateException("Cannot stop a timer that is not running"); + } if(--$this->timingDepth !== 0 or $this->start == 0){ return; }