Don't copy lpstrFileTitle if given NULL pointer for this.

Delphi 2.0 passes NULL for lpstrFileTitle to GetOpen/SaveFileName.
This commit is contained in:
Norman Stevens 1999-03-09 17:34:30 +00:00 committed by Alexandre Julliard
parent 5eaf775dae
commit e16512ba82
1 changed files with 7 additions and 3 deletions

View File

@ -1167,7 +1167,9 @@ static BOOL Commdlg_GetFileNameA( BOOL16 (CALLBACK *dofunction)(SEGPTR x),
if (ofn16->lpstrFileTitle)
{
strcpy(ofn->lpstrFileTitle,PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
if (ofn->lpstrFileTitle)
strcpy(ofn->lpstrFileTitle,
PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
}
SEGPTR_FREE(ofn16);
@ -1270,8 +1272,10 @@ static BOOL Commdlg_GetFileNameW( BOOL16 (CALLBACK *dofunction)(SEGPTR x),
}
if (ofn16->lpstrFileTitle) {
lstrcpyAtoW(ofn->lpstrFileTitle,PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
if (ofn->lpstrFileTitle)
lstrcpyAtoW(ofn->lpstrFileTitle,
PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
SEGPTR_FREE(PTR_SEG_TO_LIN(ofn16->lpstrFileTitle));
}
SEGPTR_FREE(ofn16);
return ret;