Skip to content

Commit

Permalink
More defensive approach to checking the internal pointer (GitHub issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Dec 11, 2023
1 parent 8909b7b commit e4b3f11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DirTreeModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,11 @@ QModelIndex DirTreeModel::parent( const QModelIndex & index ) const
return QModelIndex();

FileInfo * child = static_cast<FileInfo*>( index.internalPointer() );
CHECK_MAGIC( child );

if ( ! child || ! child->checkMagicNumber() )
return QModelIndex();

FileInfo * parent = child->parent();
CHECK_PTR( parent );

if ( ! parent || parent == _tree->root() )
return QModelIndex();
Expand Down

0 comments on commit e4b3f11

Please sign in to comment.