From: Brandon Turner Date: Sun, 9 Oct 2005 19:08:18 +0000 (+0000) Subject: Make sure that FileList is not empty. fixes bug #884. X-Git-Tag: ReactOS-0.2.8~45 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=0f30dcfddd808faff88f5e613f9708886d1fa3d7 Make sure that FileList is not empty. fixes bug #884. svn path=/trunk/; revision=18382 --- diff --git a/reactos/subsys/system/cmd/filecomp.c b/reactos/subsys/system/cmd/filecomp.c index 1e174d3e3f7..5540bc37b0c 100644 --- a/reactos/subsys/system/cmd/filecomp.c +++ b/reactos/subsys/system/cmd/filecomp.c @@ -535,7 +535,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor) while (_istspace (*line)) line++; - if(!_tcsncmp (line, _T("rd "), 3) || !_tcsncmp (line, _T("cd "), 3)) + if(!_tcsnicmp (line, _T("rd "), 3) || !_tcsnicmp (line, _T("cd "), 3)) ShowAll = FALSE; /* Copy the string, str can be edited and orginal should not be */ @@ -645,7 +645,17 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor) }while(FindNextFile(hFile,&file)); - + /* Check the size of the list to see if we + found any matches */ + if(FileListSize == 0) + { + _tcscpy(strOut,szOrginal); + CloseHandle(hFile); + if(FileList != NULL) + free(FileList); + return; + + } /* Sort the files */ qsort(FileList,FileListSize,sizeof(FileName), compare);