diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 1453396ccf7..282582b748c 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -650,7 +650,7 @@ int COMDLG32_SplitFileNames(LPWSTR lpstrEdit, UINT nStrLen, LPWSTR *lpstrFileLis if ( lpstrEdit[nStrCharCount]=='"' ) { nStrCharCount++; - while ((lpstrEdit[nStrCharCount]!='"') && (nStrCharCount <= nStrLen)) + while ((nStrCharCount <= nStrLen) && (lpstrEdit[nStrCharCount]!='"')) { (*lpstrFileList)[nFileIndex++] = lpstrEdit[nStrCharCount]; nStrCharCount++;