X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/1066f857936e27fbf24d6b96b5be7703a2c0b0bf..2f03297fba2a10dbc860018fac7ad07c83b08ce8:/lmessages.pas

diff --git a/lmessages.pas b/lmessages.pas
index d6e3745..e17ccfe 100755
--- a/lmessages.pas
+++ b/lmessages.pas
@@ -409,15 +409,15 @@ begin
       //we have to get the window procedure while the structurelock
       //is still held as the window could be destroyed from another thread
       //otherwise.
-      if window <> nil then begin
+      if window <> nil then begin
         windowproc := window.windowproc;
-      end else begin
-        windowproc := nil;
-      end;
+      end else begin
+        windowproc := nil;
+      end;
     finally
       structurelock.release;
     end;
-    if windowproc <> nil then begin
+    if assigned(windowproc) then begin
       result := windowproc(lpmsg.hwnd,lpmsg.message,lpmsg.wparam,lpmsg.lparam);
     end else begin
       result := -1;
@@ -494,7 +494,7 @@ end;
 
 function PeekMessage(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): WINBOOL;
 begin
-  result := getmessageinternal(lpmsg,hwnd,wmsgfiltermin,wmsgfiltermax,PM_REMOVE,true);
+  result := getmessageinternal(lpmsg,hwnd,wmsgfiltermin,wmsgfiltermax,wRemoveMsg,true);
 end;
 
 function SetEvent(hEvent:THevent):WINBOOL;