Fix segmentation fault when '.' or '..' is first entry in readdir
This commit is contained in:
parent
55efe036dd
commit
e976ffddc1
@ -22,6 +22,8 @@ namespace FSLib{
|
|||||||
public:
|
public:
|
||||||
Iterator( const Directory &d_ ) : d(opendir(d_.path())) {
|
Iterator( const Directory &d_ ) : d(opendir(d_.path())) {
|
||||||
current_entry = readdir(d);
|
current_entry = readdir(d);
|
||||||
|
if( current_entry != nullptr && ( !strcmp(current_entry->d_name, ".") || !strcmp(current_entry->d_name, "..") ) )
|
||||||
|
++(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator( const Directory &d_, const struct dirent *current_entry_) : d(opendir(d_.path())), current_entry(current_entry_) {}
|
Iterator( const Directory &d_, const struct dirent *current_entry_) : d(opendir(d_.path())), current_entry(current_entry_) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user