Check the surface pointer before accessing it to get a handle
authorGregor Schneider <grschneider@gmail.com>
Sat, 22 Aug 2009 18:44:17 +0000 (18:44 +0000)
committerGregor Schneider <grschneider@gmail.com>
Sat, 22 Aug 2009 18:44:17 +0000 (18:44 +0000)
svn path=/trunk/; revision=42866

reactos/dll/win32/gdi32/misc/gdientry.c

index b5a6352..eb51065 100644 (file)
@@ -2047,15 +2047,18 @@ DdGetDxHandle(LPDDRAWI_DIRECTDRAW_LCL pDDraw,
               BOOL bRelease)
 {
     HANDLE hDD = NULL;
-    HANDLE hSurface = (HANDLE)pSurface->hDDSurface;
+    HANDLE hSurface = NULL;
 
     /* Check if we already have a surface */
     if (!pSurface)
     {
         /* We don't have one, use the DirectDraw Object handle instead */
-        hSurface = NULL;
         hDD = GetDdHandle(pDDraw->lpGbl->hDD);
-     }
+    }
+    else
+    {
+        hSurface = (HANDLE)pSurface->hDDSurface;
+    }
 
     /* Call the API */
     return (HANDLE)NtGdiDdGetDxHandle(hDD, hSurface, bRelease);