Make sure that FileList is not empty. fixes bug #884.
Modified: trunk/reactos/subsys/system/cmd/filecomp.c
_____
Modified: trunk/reactos/subsys/system/cmd/filecomp.c
--- trunk/reactos/subsys/system/cmd/filecomp.c 2005-10-09 16:58:13 UTC
(rev 18381)
+++ trunk/reactos/subsys/system/cmd/filecomp.c 2005-10-09 19:08:18 UTC
(rev 18382)
@@ -535,7 +535,7 @@
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 @@
}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);
Show replies by date