diff --git a/controls/button.c b/controls/button.c
index 2fabeba6ee275220c9c04ed2628b4c8dd0697299..d3fd297a60b56e2960fcc399f1626617ae412d02 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -407,12 +407,14 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
  */
 static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
-    LRESULT res;
+    LRESULT res = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam,TRUE);
-
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam,TRUE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return res;
 }
 
@@ -422,12 +424,14 @@ static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
  */
 static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
-    LRESULT res;
+    LRESULT res = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam,FALSE);
-
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        res = ButtonWndProc_locked(wndPtr,uMsg,wParam,lParam,FALSE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return res;
 }
 
diff --git a/controls/combo.c b/controls/combo.c
index 87a843eca3e1d4cb3c28802277a208718d0822e0..dc2f4b56339ae041ca1a037c28e2255e9742da6f 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -1863,7 +1863,6 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
 static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
                                     WPARAM wParam, LPARAM lParam, BOOL unicode )
 {
-    if( pWnd ) {
       LPHEADCOMBO	lphc = CB_GETPTR(pWnd);
       HWND		hwnd = pWnd->hwndSelf;
 
@@ -2252,11 +2251,9 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
 		    WARN("unknown msg WM_USER+%04x wp=%04x lp=%08lx\n",
 			message - WM_USER, wParam, lParam );
 		break;
-    }
-    return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
-		     DefWindowProcA(hwnd, message, wParam, lParam);
-  }
-  return CB_ERR;
+      }
+      return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
+                       DefWindowProcA(hwnd, message, wParam, lParam);
 }
 
 /***********************************************************************
@@ -2267,10 +2264,14 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
  */
 static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
-    WND*	pWnd = WIN_FindWndPtr(hwnd);
-    LRESULT retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, FALSE);
+    LRESULT retvalue = 0;
+    WND* pWnd = WIN_FindWndPtr(hwnd);
 
-    WIN_ReleaseWndPtr(pWnd);
+    if (pWnd)
+    {
+        retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, FALSE);
+        WIN_ReleaseWndPtr(pWnd);
+    }
     return retvalue;
 }
 
@@ -2279,9 +2280,13 @@ static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPA
  */
 static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
-    WND*	pWnd = WIN_FindWndPtr(hwnd);
-    LRESULT retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, TRUE);
+    LRESULT retvalue = 0;
+    WND* pWnd = WIN_FindWndPtr(hwnd);
 
-    WIN_ReleaseWndPtr(pWnd);
+    if (pWnd)
+    {
+        retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, TRUE);
+        WIN_ReleaseWndPtr(pWnd);
+    }
     return retvalue;
 }
diff --git a/controls/edit.c b/controls/edit.c
index 717c7a9c4ca7d19214fecb3cd417d57c79300f1c..8a8d1f1d2b5ba7f5b04ae5d189eaffa3b12d79b9 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -395,7 +395,7 @@ static LRESULT WINAPI EditWndProc_locked( WND *wnd, UINT msg,
 	switch (msg) {
 	case WM_DESTROY:
 		DPRINTF_EDIT_MSG32("WM_DESTROY");
-		EDIT_WM_Destroy(wnd, es);
+		if (es) EDIT_WM_Destroy(wnd, es);
                 result = 0;
                 goto END;
 
@@ -1121,12 +1121,14 @@ static LRESULT WINAPI EditWndProc_locked( WND *wnd, UINT msg,
  */
 LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    LRESULT res;
+    LRESULT res = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    res = EditWndProc_locked(wndPtr, uMsg, wParam, lParam, TRUE);
-
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        res = EditWndProc_locked(wndPtr, uMsg, wParam, lParam, TRUE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return res;
 }
 
@@ -1136,12 +1138,14 @@ LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  */
 LRESULT WINAPI EditWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    LRESULT res;
+    LRESULT res = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    res = EditWndProc_locked(wndPtr, uMsg, wParam, lParam, FALSE);
-
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        res = EditWndProc_locked(wndPtr, uMsg, wParam, lParam, FALSE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return res;
 }
 
diff --git a/controls/icontitle.c b/controls/icontitle.c
index 0f4e4e6a3d6d87449f299f63700d790f8b777cec..770232fccde8262a45bde384f59eb60210b5949f 100644
--- a/controls/icontitle.c
+++ b/controls/icontitle.c
@@ -200,6 +200,9 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
     LRESULT retvalue;
     WND *wnd = WIN_FindWndPtr( hWnd );
 
+    if( !wnd )
+      return 0;
+
     switch( msg )
     {
         case WM_CREATE:
diff --git a/controls/listbox.c b/controls/listbox.c
index 1894ebc9b8bdf3a8bdc7eecf66432b301b451c7a..99e4103927b3484761175f05f24562f1d9a24ba6 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -2466,7 +2466,6 @@ static LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg,
     LB_DESCR *descr;
     HWND	hwnd = wnd->hwndSelf;
 
-    if (!wnd) return 0;
     if (!(descr = *(LB_DESCR **)wnd->wExtra))
     {
         if (msg == WM_CREATE)
@@ -3022,10 +3021,14 @@ static LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg,
  */
 static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
-    WND*	wndPtr = WIN_FindWndPtr( hwnd );
-    LRESULT	res = ListBoxWndProc_locked(wndPtr, msg, wParam, lParam, FALSE);
+    LRESULT res = 0;
+    WND* wndPtr = WIN_FindWndPtr( hwnd );
 
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        res = ListBoxWndProc_locked(wndPtr, msg, wParam, lParam, FALSE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return res;
 }
 
@@ -3034,10 +3037,14 @@ static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARA
  */
 static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
-    WND*	wndPtr = WIN_FindWndPtr( hwnd );
-    LRESULT	res = ListBoxWndProc_locked(wndPtr, msg, wParam, lParam, TRUE);
+    LRESULT res = 0;
+    WND* wndPtr = WIN_FindWndPtr( hwnd );
 
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        res = ListBoxWndProc_locked(wndPtr, msg, wParam, lParam, TRUE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return res;
 }
 
@@ -3051,151 +3058,144 @@ static LRESULT WINAPI ComboLBWndProc_locked( WND* wnd, UINT msg,
 {
     LRESULT lRet = 0;
     HWND hwnd;
+    LB_DESCR *descr = *(LB_DESCR **)wnd->wExtra;
 
-    if (wnd)
-    {
-	LB_DESCR *descr = *(LB_DESCR **)wnd->wExtra;
+    TRACE_(combo)("[%04x]: msg %s wp %08x lp %08lx\n",
+                  wnd->hwndSelf, SPY_GetMsgName(msg), wParam, lParam );
 
-        TRACE_(combo)("[%04x]: msg %s wp %08x lp %08lx\n",
-		     wnd->hwndSelf, SPY_GetMsgName(msg), wParam, lParam );
+    hwnd = wnd->hwndSelf;
 
-	hwnd = wnd->hwndSelf;
+    if( descr || msg == WM_CREATE )
+    {
+        LPHEADCOMBO lphc = (descr) ? descr->lphc : NULL;
 
-	if( descr || msg == WM_CREATE )
+        switch( msg )
         {
-	    LPHEADCOMBO lphc = (descr) ? descr->lphc : NULL;
+        case WM_CREATE:
+            {
+                CREATESTRUCTA *lpcs = (CREATESTRUCTA *)lParam;
+                TRACE_(combo)("\tpassed parent handle = %p\n",lpcs->lpCreateParams);
+                lphc = (LPHEADCOMBO)(lpcs->lpCreateParams);
+                return LISTBOX_Create( wnd, lphc );
+            }
+        case WM_MOUSEMOVE:
+            if ( (TWEAK_WineLook > WIN31_LOOK) &&
+                 (CB_GETTYPE(lphc) != CBS_SIMPLE) )
+            {
+                POINT   mousePos;
+                BOOL    captured;
+                RECT    clientRect;
 
-	    switch( msg )
-	    {
-		case WM_CREATE:
-#define lpcs	((LPCREATESTRUCTA)lParam)
-		     TRACE_(combo)("\tpassed parent handle = 0x%08x\n", 
-				  (UINT)lpcs->lpCreateParams);
-
-		     lphc = (LPHEADCOMBO)(lpcs->lpCreateParams);
-#undef  lpcs
-		     return LISTBOX_Create( wnd, lphc );
-	        case WM_MOUSEMOVE:
-		     if ( (TWEAK_WineLook > WIN31_LOOK) &&
-			  (CB_GETTYPE(lphc) != CBS_SIMPLE) )
-		     {
-		       POINT   mousePos;
-		       BOOL    captured;
-		       RECT    clientRect;
-
-		       mousePos.x = (INT16)LOWORD(lParam);
-		       mousePos.y = (INT16)HIWORD(lParam);
-
-		       /*
-			* If we are in a dropdown combobox, we simulate that
-			* the mouse is captured to show the tracking of the item.
-			*/
-		       GetClientRect(hwnd, &clientRect);
-
-		       if (PtInRect( &clientRect, mousePos ))
-		       {
-		           captured = descr->captured;
-		           descr->captured = TRUE;			 
-		           
-		           LISTBOX_HandleMouseMove( wnd, descr, 
-						    mousePos.x, mousePos.y);
-
-                           descr->captured = captured;
-
-                       }
-                       else
-                       {
-		           LISTBOX_HandleMouseMove( wnd, descr, 
-						    mousePos.x, mousePos.y);
-                       }
-
-		       return 0;
-
-		     }
-		     else
-		     {
-		       /*
-			* If we are in Win3.1 look, go with the default behavior.
-			*/
-		       return unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
-		                        ListBoxWndProcA( hwnd, msg, wParam, lParam );
-		     }
-  	        case WM_LBUTTONUP:
-		     if (TWEAK_WineLook > WIN31_LOOK)
-		     {
-		       POINT mousePos;
-		       RECT  clientRect;
-
-		       /*
-			* If the mouse button "up" is not in the listbox,
-			* we make sure there is no selection by re-selecting the
-			* item that was selected when the listbox was made visible.
-			*/
-		       mousePos.x = (INT16)LOWORD(lParam);
-		       mousePos.y = (INT16)HIWORD(lParam);
-
-		       GetClientRect(hwnd, &clientRect);
-
-		       /*
-			* When the user clicks outside the combobox and the focus
-			* is lost, the owning combobox will send a fake buttonup with
-			* 0xFFFFFFF as the mouse location, we must also revert the
-			* selection to the original selection.
-			*/
-		       if ( (lParam == (LPARAM)-1) ||
-			    (!PtInRect( &clientRect, mousePos )) )
-		       {
-			 LISTBOX_MoveCaret( wnd,
-					    descr, 
-					    lphc->droppedIndex, 
-					    FALSE );
-		       }
-		     }
-		     return LISTBOX_HandleLButtonUp( wnd, descr );
-		case WM_LBUTTONDBLCLK:
-		case WM_LBUTTONDOWN:
-                     return LISTBOX_HandleLButtonDownCombo(wnd, descr, msg, wParam, 
-                                          (INT16)LOWORD(lParam),
-                                          (INT16)HIWORD(lParam) );
-                case WM_NCACTIVATE:
-                     return FALSE;
-		case WM_KEYDOWN:
-		     if( CB_GETTYPE(lphc) != CBS_SIMPLE )
-		     {
-			 /* for some reason(?) Windows makes it possible to
-			  * show/hide ComboLBox by sending it WM_KEYDOWNs */
-
-		         if( (!(lphc->wState & CBF_EUI) && wParam == VK_F4) ||
-			     ( (lphc->wState & CBF_EUI) && !(lphc->wState & CBF_DROPPED)
-			       && (wParam == VK_DOWN || wParam == VK_UP)) )
-			 {
-			     COMBO_FlipListbox( lphc, FALSE, FALSE );
-                             return 0;
-			 }
-		     }
-		     return LISTBOX_HandleKeyDown( wnd, descr, wParam );
-
-		case LB_SETCURSEL16:
-		case LB_SETCURSEL:
-		     lRet = unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
-		                      ListBoxWndProcA( hwnd, msg, wParam, lParam );
-		     lRet =(lRet == LB_ERR) ? lRet : descr->selected_item; 
-		     return lRet;
-		case WM_NCDESTROY:
-		     if( CB_GETTYPE(lphc) != CBS_SIMPLE )
-			 lphc->hWndLBox = 0;
-		     /* fall through */
-
-	        default:
-                    return unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
-                                     ListBoxWndProcA( hwnd, msg, wParam, lParam );
-	    }
-        }
-        lRet = unicode ? DefWindowProcW( hwnd, msg, wParam, lParam ) :
-			 DefWindowProcA( hwnd, msg, wParam, lParam );
+                mousePos.x = (INT16)LOWORD(lParam);
+                mousePos.y = (INT16)HIWORD(lParam);
+
+                /*
+                 * If we are in a dropdown combobox, we simulate that
+                 * the mouse is captured to show the tracking of the item.
+                 */
+                GetClientRect(hwnd, &clientRect);
+
+                if (PtInRect( &clientRect, mousePos ))
+                {
+                    captured = descr->captured;
+                    descr->captured = TRUE;
+
+                    LISTBOX_HandleMouseMove( wnd, descr,
+                                             mousePos.x, mousePos.y);
+
+                    descr->captured = captured;
 
-        TRACE_(combo)("\t default on msg [%04x]\n", (UINT16)msg );
+                }
+                else
+                {
+                    LISTBOX_HandleMouseMove( wnd, descr,
+                                             mousePos.x, mousePos.y);
+                }
+
+                return 0;
+
+            }
+            else
+            {
+                /*
+                 * If we are in Win3.1 look, go with the default behavior.
+                 */
+                return unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
+                    ListBoxWndProcA( hwnd, msg, wParam, lParam );
+            }
+        case WM_LBUTTONUP:
+            if (TWEAK_WineLook > WIN31_LOOK)
+            {
+                POINT mousePos;
+                RECT  clientRect;
+
+                /*
+                 * If the mouse button "up" is not in the listbox,
+                 * we make sure there is no selection by re-selecting the
+                 * item that was selected when the listbox was made visible.
+                 */
+                mousePos.x = (INT16)LOWORD(lParam);
+                mousePos.y = (INT16)HIWORD(lParam);
+
+                GetClientRect(hwnd, &clientRect);
+
+                /*
+                 * When the user clicks outside the combobox and the focus
+                 * is lost, the owning combobox will send a fake buttonup with
+                 * 0xFFFFFFF as the mouse location, we must also revert the
+                 * selection to the original selection.
+                 */
+                if ( (lParam == (LPARAM)-1) ||
+                     (!PtInRect( &clientRect, mousePos )) )
+                {
+                    LISTBOX_MoveCaret( wnd, descr, lphc->droppedIndex, FALSE );
+                }
+            }
+            return LISTBOX_HandleLButtonUp( wnd, descr );
+        case WM_LBUTTONDBLCLK:
+        case WM_LBUTTONDOWN:
+            return LISTBOX_HandleLButtonDownCombo(wnd, descr, msg, wParam,
+                                                  (INT16)LOWORD(lParam),
+                                                  (INT16)HIWORD(lParam) );
+        case WM_NCACTIVATE:
+            return FALSE;
+        case WM_KEYDOWN:
+            if( CB_GETTYPE(lphc) != CBS_SIMPLE )
+            {
+                /* for some reason(?) Windows makes it possible to
+                 * show/hide ComboLBox by sending it WM_KEYDOWNs */
+
+                if( (!(lphc->wState & CBF_EUI) && wParam == VK_F4) ||
+                    ( (lphc->wState & CBF_EUI) && !(lphc->wState & CBF_DROPPED)
+                      && (wParam == VK_DOWN || wParam == VK_UP)) )
+                {
+                    COMBO_FlipListbox( lphc, FALSE, FALSE );
+                    return 0;
+                }
+            }
+            return LISTBOX_HandleKeyDown( wnd, descr, wParam );
+
+        case LB_SETCURSEL16:
+        case LB_SETCURSEL:
+            lRet = unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
+                ListBoxWndProcA( hwnd, msg, wParam, lParam );
+            lRet =(lRet == LB_ERR) ? lRet : descr->selected_item; 
+            return lRet;
+        case WM_NCDESTROY:
+            if( CB_GETTYPE(lphc) != CBS_SIMPLE )
+                lphc->hWndLBox = 0;
+            /* fall through */
+
+        default:
+            return unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
+                ListBoxWndProcA( hwnd, msg, wParam, lParam );
+        }
     }
+    lRet = unicode ? DefWindowProcW( hwnd, msg, wParam, lParam ) :
+        DefWindowProcA( hwnd, msg, wParam, lParam );
+
+    TRACE_(combo)("\t default on msg [%04x]\n", (UINT16)msg );
+
     return lRet;
 }
 
@@ -3211,10 +3211,14 @@ static LRESULT WINAPI ComboLBWndProc_locked( WND* wnd, UINT msg,
 LRESULT WINAPI ComboLBWndProcA( HWND hwnd, UINT msg,
                                WPARAM wParam, LPARAM lParam )
 {
+    LRESULT res = 0;
     WND *wnd = WIN_FindWndPtr( hwnd );
-    LRESULT res = ComboLBWndProc_locked(wnd, msg, wParam, lParam, FALSE);
 
-    WIN_ReleaseWndPtr(wnd);
+    if (wnd)
+    {
+        res = ComboLBWndProc_locked(wnd, msg, wParam, lParam, FALSE);
+        WIN_ReleaseWndPtr(wnd);
+    }
     return res;
 }
 
@@ -3223,9 +3227,13 @@ LRESULT WINAPI ComboLBWndProcA( HWND hwnd, UINT msg,
  */
 LRESULT WINAPI ComboLBWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
+    LRESULT res = 0;
     WND *wnd = WIN_FindWndPtr( hwnd );
-    LRESULT res = ComboLBWndProc_locked(wnd, msg, wParam, lParam, TRUE);
 
-    WIN_ReleaseWndPtr(wnd);
+    if (wnd)
+    {
+        res = ComboLBWndProc_locked(wnd, msg, wParam, lParam, TRUE);
+        WIN_ReleaseWndPtr(wnd);
+    }
     return res;
 }
diff --git a/controls/scroll.c b/controls/scroll.c
index 22bf3693038e1b85a37c75937b5f8185b68b1674..25a277ddefa2bcebb22fb49a205238800f5c8d22 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -1125,6 +1125,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
  */
 static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
+    if (!IsWindow( hwnd )) return 0;
+
     switch(message)
     {
     case WM_CREATE:
diff --git a/controls/static.c b/controls/static.c
index 488b664c498c556b9e304f8abcfedbc063038e08..21ad0c2da7162da817eefa843861ecd5c236d6bf 100644
--- a/controls/static.c
+++ b/controls/static.c
@@ -356,12 +356,14 @@ END:
  */
 static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
-    LRESULT lResult;
+    LRESULT lResult = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, FALSE);
-
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, FALSE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return lResult;
 }
 
@@ -370,12 +372,14 @@ static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
  */
 static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
-    LRESULT lResult;
+    LRESULT lResult = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, TRUE);
-
-    WIN_ReleaseWndPtr(wndPtr);
+    if (wndPtr)
+    {
+        lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, TRUE);
+        WIN_ReleaseWndPtr(wndPtr);
+    }
     return lResult;
 }