mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
TimingsHandler: stop throwing exceptions when timers aren't stopped in the right order
this is usually because of an uncaught exception interacting with a try...finally block. This will normally result in a crash anyway, and we don't want to obscure the real error.
This commit is contained in:
parent
674b65f789
commit
f9318bf286
@ -189,12 +189,12 @@ class TimingsHandler{
|
||||
}
|
||||
|
||||
$record = TimingsRecord::getCurrentRecord();
|
||||
if($record !== null){
|
||||
if($record->getTimerId() !== spl_object_id($this)){
|
||||
throw new \LogicException("Timer \"" . $record->getName() . "\" should have been stopped before stopping timer \"" . $this->name . "\"");
|
||||
}
|
||||
$timerId = spl_object_id($this);
|
||||
for(; $record !== null && $record->getTimerId() !== $timerId; $record = TimingsRecord::getCurrentRecord()){
|
||||
\GlobalLogger::get()->error("Timer \"" . $record->getName() . "\" should have been stopped before stopping timer \"" . $this->name . "\"");
|
||||
$record->stopTiming($now);
|
||||
}
|
||||
$record?->stopTiming($now);
|
||||
if($this->parent !== null){
|
||||
$this->parent->internalStopTiming($now);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user