From 23f6e8bdb4882da75e626687a7ac2299152304b7 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 11 Sep 2008 10:59:45 -0700 Subject: [PATCH] Don't crash handling WM_CONTEXTMENU with an invalid HWND. Fixes Coverity id 267. --- dlls/user32/defwnd.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index dde245a..cb7888b 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -371,7 +371,10 @@ static LRESULT DEFWND_DefWinProc( HWND h LONG hitcode; POINT pt; WND *wndPtr = WIN_GetPtr( hwnd ); - HMENU hMenu = wndPtr->hSysMenu; + HMENU hMenu; + + if (!wndPtr) return 0; + hMenu = wndPtr->hSysMenu; WIN_ReleasePtr( wndPtr ); if (!hMenu) return 0; pt.x = (short)LOWORD(lParam); -- 1.4.1