wintab32: Check for NULL before using context.

This commit is contained in:
Peter Urbanec 2009-01-07 10:46:04 +11:00 committed by Alexandre Julliard
parent 0eebcf57c3
commit 65b3393dce
1 changed files with 18 additions and 0 deletions

View File

@ -685,6 +685,12 @@ BOOL WINAPI WTOverlap(HCTX hCtx, BOOL fToTop)
EnterCriticalSection(&csTablet);
context = TABLET_FindOpenContext(hCtx);
if (!context)
{
LeaveCriticalSection(&csTablet);
return FALSE;
}
/* if we want to send to top and it's not already there */
if (fToTop && context->context.lcStatus != CXS_ONTOP)
{
@ -777,6 +783,12 @@ BOOL WINAPI WTSetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
EnterCriticalSection(&csTablet);
context = TABLET_FindOpenContext(hCtx);
if (!context)
{
LeaveCriticalSection(&csTablet);
return FALSE;
}
LOGCONTEXTAtoW(lpLogCtx, &context->context);
LeaveCriticalSection(&csTablet);
@ -799,6 +811,12 @@ BOOL WINAPI WTSetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx)
EnterCriticalSection(&csTablet);
context = TABLET_FindOpenContext(hCtx);
if (!context)
{
LeaveCriticalSection(&csTablet);
return FALSE;
}
memmove(&context->context, lpLogCtx, sizeof(LOGCONTEXTW));
LeaveCriticalSection(&csTablet);