do not delete invalid pointer

This commit is contained in:
unK
2008-10-28 12:43:02 +01:00
parent e18e6ef3a8
commit 6b2356318f

View File

@@ -64,11 +64,10 @@ namespace
{ {
dirent **list; dirent **list;
int n = scandir(dir.c_str(), &list, NULL, alphasort); int n = scandir(dir.c_str(), &list, NULL, alphasort);
if (n < 2)
{ if (n < 0)
delete list;
return; return;
}
struct stat file_stat; struct stat file_stat;
string full_path; string full_path;
for (int i = 2; i < n; i++) for (int i = 2; i < n; i++)