fix AccessViolation bug (#835861)
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 4 Nov 2003 23:37:53 +0000 (23:37 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 4 Nov 2003 23:37:53 +0000 (23:37 +0000)
src/mesa/drivers/windows/gdi/wmesa.c

index 01b08e850946652e29028bc3d410a2a5c3ffd000..b923c999416440b3e339f6d474df948817986078 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.1 2003/07/24 03:47:46 kschultz Exp $ */
+/* $Id: wmesa.c,v 1.2 2003/11/04 23:37:53 brianp Exp $ */
 
 /*
  * Windows (Win32) device driver for Mesa 3.4
@@ -2247,7 +2247,14 @@ void RemoveContext(HWND hWnd)
 
 static LRESULT CALLBACK MyWndProc(HWND hwnd,UINT message,WPARAM wParam, LPARAM lParam)
 {
-       WMesaContext wc = Current->hwnd == hwnd ? Current : FindContext(hwnd);
+       WMesaContext wc;
+
+       if (Current==0 || Current->hwnd != hwnd)
+               wc=FindContext(hwnd);
+       else
+               wc=Current;
+
+
         if( wc )
         {
                LRESULT lret = CallWindowProc((WNDPROC)(wc->oldWndProc),hwnd,message,wParam,lParam);