Check for valid dialog info before using it.

This commit is contained in:
Alexandre Julliard 2002-06-28 23:32:29 +00:00
parent cff4b6d09c
commit bb05bb62ee
1 changed files with 6 additions and 6 deletions

View File

@ -211,15 +211,14 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
return 0; return 0;
case DM_SETDEFID: case DM_SETDEFID:
if (dlgInfo->flags & DF_END) return 1; if (dlgInfo && !(dlgInfo->flags & DF_END))
DEFDLG_SetDefButton( hwnd, dlgInfo, DEFDLG_SetDefButton( hwnd, dlgInfo, wParam ? GetDlgItem( hwnd, wParam ) : 0 );
wParam ? GetDlgItem( hwnd, wParam ) : 0 );
return 1; return 1;
case DM_GETDEFID: case DM_GETDEFID:
if (dlgInfo && !(dlgInfo->flags & DF_END))
{ {
HWND hwndDefId; HWND hwndDefId;
if (dlgInfo->flags & DF_END) return 0;
if (dlgInfo->idResult) if (dlgInfo->idResult)
return MAKELONG( dlgInfo->idResult, DC_HASDEFID ); return MAKELONG( dlgInfo->idResult, DC_HASDEFID );
if ((hwndDefId = DEFDLG_FindDefButton( hwnd ))) if ((hwndDefId = DEFDLG_FindDefButton( hwnd )))
@ -228,6 +227,7 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
return 0; return 0;
case WM_NEXTDLGCTL: case WM_NEXTDLGCTL:
if (dlgInfo)
{ {
HWND hwndDest = (HWND)wParam; HWND hwndDest = (HWND)wParam;
if (!lParam) if (!lParam)
@ -252,7 +252,7 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
return DefWindowProcA( hwnd, msg, wParam, lParam ); return DefWindowProcA( hwnd, msg, wParam, lParam );
case WM_GETFONT: case WM_GETFONT:
return dlgInfo->hUserFont; return dlgInfo ? dlgInfo->hUserFont : 0;
case WM_CLOSE: case WM_CLOSE:
PostMessageA( hwnd, WM_COMMAND, IDCANCEL, PostMessageA( hwnd, WM_COMMAND, IDCANCEL,