From 50b7732821d5f44ce6a1df17c1e7c5a3f639fc5e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 16 May 2009 12:57:42 +0000 Subject: fixed bug in UHookableEvent that caused a crash when owning plugin of last hook is unloaded git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1730 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/src/lua/UHookableEvent.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Lua/src/lua/UHookableEvent.pas b/Lua/src/lua/UHookableEvent.pas index a3a87da6..de5a8a83 100644 --- a/Lua/src/lua/UHookableEvent.pas +++ b/Lua/src/lua/UHookableEvent.pas @@ -219,16 +219,19 @@ begin While (Cur <> nil) do begin - If (Cur.Parent = Parent) then + if (Cur.Parent = Parent) then begin //found a hook from parent => remove it - If (Prev <> nil) then + if (Prev <> nil) then Prev.Next := Cur.Next Else LastHook := Cur.Next; Dispose(Cur); - Cur := Prev.Next; + if (Prev <> nil) then + Cur := Prev.Next + else + Cur := LastHook; end else //move through the chain begin -- cgit v1.2.3