diff --git a/src/Hypercube.Ecs/Events/Handling/EventHandlerList.cs b/src/Hypercube.Ecs/Events/Handling/EventHandlerList.cs index 4e4264b..76e92a3 100644 --- a/src/Hypercube.Ecs/Events/Handling/EventHandlerList.cs +++ b/src/Hypercube.Ecs/Events/Handling/EventHandlerList.cs @@ -29,13 +29,14 @@ private void AddInternal(object handler, int priority) try { var entry = new HandlerEntry(priority, handler); - if (priority == NoPriority) + var index = _handlers.FindIndex(h => priority > h.Priority); + + if (index == -1) { _handlers.Add(entry); return; } - - var index = _handlers.FindIndex(h => priority > h.Priority); + _handlers.Insert(index, entry); } finally