cmd: Don't crash on 'if exist' without parameter.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51598
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-12-20 10:29:01 +01:00 committed by Alexandre Julliard
parent 488a00c3be
commit 535da77552
1 changed files with 2 additions and 1 deletions

View File

@ -2811,8 +2811,9 @@ int evaluate_if_condition(WCHAR *p, WCHAR **command, int *test, int *negate)
WCHAR *param = WCMD_parameter(p, 1+(*negate), NULL, FALSE, FALSE); WCHAR *param = WCMD_parameter(p, 1+(*negate), NULL, FALSE, FALSE);
int len = lstrlenW(param); int len = lstrlenW(param);
if (!len) goto syntax_err;
/* FindFirstFile does not like a directory path ending in '\', append a '.' */ /* FindFirstFile does not like a directory path ending in '\', append a '.' */
if (len && param[len-1] == '\\') lstrcatW(param, L"."); if (param[len-1] == '\\') lstrcatW(param, L".");
hff = FindFirstFileW(param, &fd); hff = FindFirstFileW(param, &fd);
*test = (hff != INVALID_HANDLE_VALUE ); *test = (hff != INVALID_HANDLE_VALUE );