mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 07:39:57 +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();
|
$record = TimingsRecord::getCurrentRecord();
|
||||||
if($record !== null){
|
$timerId = spl_object_id($this);
|
||||||
if($record->getTimerId() !== spl_object_id($this)){
|
for(; $record !== null && $record->getTimerId() !== $timerId; $record = TimingsRecord::getCurrentRecord()){
|
||||||
throw new \LogicException("Timer \"" . $record->getName() . "\" should have been stopped before stopping timer \"" . $this->name . "\"");
|
\GlobalLogger::get()->error("Timer \"" . $record->getName() . "\" should have been stopped before stopping timer \"" . $this->name . "\"");
|
||||||
}
|
|
||||||
$record->stopTiming($now);
|
$record->stopTiming($now);
|
||||||
}
|
}
|
||||||
|
$record?->stopTiming($now);
|
||||||
if($this->parent !== null){
|
if($this->parent !== null){
|
||||||
$this->parent->internalStopTiming($now);
|
$this->parent->internalStopTiming($now);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user