Fix crash in FileSystemModel.

This commit is contained in:
Martín Lucas Golini
2024-03-18 00:11:41 -03:00
parent 014d15fa00
commit 0a68e1c412

View File

@@ -102,10 +102,10 @@ FileSystemModel::Node* FileSystemModel::Node::createChild( const std::string& ch
auto child = eeNew( Node, ( std::move( file ), this ) );
if ( model.getDisplayConfig().ignoreHidden && file.isHidden() )
return {};
return nullptr;
if ( model.getMode() == Mode::DirectoriesOnly && !file.isDirectory() )
return {};
return nullptr;
return child;
}
@@ -601,7 +601,7 @@ bool FileSystemModel::handleFileEventLocked( const FileEvent& event ) {
Node* childNode = parent->createChild( file.getFileName(), *this );
if ( childNode->getName().empty() )
if ( childNode == nullptr || childNode->getName().empty() )
return false;
size_t pos = getFileIndex( parent, file );