Fix assert when trying to find a child node not yet populated

This commit is contained in:
Martin Dobias 2025-02-21 11:13:34 +01:00 committed by Stefanos Natsis
parent 6f010b4933
commit a2cc42e52d

View File

@ -255,6 +255,9 @@ static QgsChunkNode *findChunkNodeFromNodeId( QgsChunkNode *rootNode, QgsPointCl
QgsPointCloudNodeId p = parentIds.takeLast(); QgsPointCloudNodeId p = parentIds.takeLast();
QgsChunkNodeId childNodeId( p.d(), p.x(), p.y(), p.z() ); QgsChunkNodeId childNodeId( p.d(), p.x(), p.y(), p.z() );
if ( !chunk->hasChildrenPopulated() )
return nullptr;
QgsChunkNode *chunkChild = nullptr; QgsChunkNode *chunkChild = nullptr;
QgsChunkNode *const *children = chunk->children(); QgsChunkNode *const *children = chunk->children();
for ( int i = 0; i < chunk->childCount(); ++i ) for ( int i = 0; i < chunk->childCount(); ++i )
@ -287,9 +290,11 @@ QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( Qgs3DMapSettin
mChunkUpdaterFactory.reset( new QgsChunkUpdaterFactory( mChunkLoaderFactory ) ); mChunkUpdaterFactory.reset( new QgsChunkUpdaterFactory( mChunkLoaderFactory ) );
connect( pcl, &QgsPointCloudLayer::chunkAttributeValuesChanged, this, [this]( const QgsPointCloudNodeId &n ) { connect( pcl, &QgsPointCloudLayer::chunkAttributeValuesChanged, this, [this]( const QgsPointCloudNodeId &n ) {
QList<QgsChunkNode *> nodes; QgsChunkNode *node = findChunkNodeFromNodeId( mRootNode, n );
nodes << findChunkNodeFromNodeId( mRootNode, n ); if ( node )
updateNodes( nodes, mChunkUpdaterFactory.get() ); {
updateNodes( QList<QgsChunkNode *>() << node, mChunkUpdaterFactory.get() );
}
} ); } );
} }
} }