diff --git a/simgear/misc/sg_dir.cxx b/simgear/misc/sg_dir.cxx index 8323e3f9..18a018ed 100644 --- a/simgear/misc/sg_dir.cxx +++ b/simgear/misc/sg_dir.cxx @@ -280,7 +280,7 @@ bool Dir::isEmpty() const int n = 0; dirent* d; - while( (d = readdir(dp)) !=NULL ) n++; + while( (d = readdir(dp)) !=NULL && (n < 4) ) n++; closedir(dp); return (n == 2); // '.' and '..' always exist