From 9d4ec238ee4bb7df0c4c869032320b849405052d Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 22 Aug 2009 18:44:17 +0000 Subject: [PATCH] Check the surface pointer before accessing it to get a handle svn path=/trunk/; revision=42866 --- reactos/dll/win32/gdi32/misc/gdientry.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/gdi32/misc/gdientry.c b/reactos/dll/win32/gdi32/misc/gdientry.c index b5a6352f536..eb510654ecc 100644 --- a/reactos/dll/win32/gdi32/misc/gdientry.c +++ b/reactos/dll/win32/gdi32/misc/gdientry.c @@ -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);