HandlerList: fixed crash on getting unused priority

these sub-arrays are no longer allocated if no handlers are registered.

fixes #5713
This commit is contained in:
Dylan K. Taylor 2023-04-21 16:19:06 +01:00
parent d06d3bc871
commit 84a16ce69a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -102,7 +102,7 @@ class HandlerList{
* @return RegisteredListener[]
*/
public function getListenersByPriority(int $priority) : array{
return $this->handlerSlots[$priority];
return $this->handlerSlots[$priority] ?? [];
}
public function getParent() : ?HandlerList{