Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix some cppcheck nullptr check warnings
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Apr 12, 2023
1 parent 6771b19 commit 3ab993f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
17 changes: 8 additions & 9 deletions src/core/qgsmaplayerlegend.cpp
Expand Up @@ -359,17 +359,16 @@ QgsDefaultVectorLayerLegend::QgsDefaultVectorLayerLegend( QgsVectorLayer *vl )
QList<QgsLayerTreeModelLegendNode *> QgsDefaultVectorLayerLegend::createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer )
{
QList<QgsLayerTreeModelLegendNode *> nodes;
if ( !mLayer )
return nodes;

if ( mLayer )
const QString placeholderImage = mLayer->legendPlaceholderImage();
if ( !placeholderImage.isEmpty() )
{
const QString placeholderImage = mLayer->legendPlaceholderImage();
if ( !placeholderImage.isEmpty() )
{
bool fitsInCache;
const QImage img = QgsApplication::imageCache()->pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache );
nodes << new QgsImageLegendNode( nodeLayer, img );
return nodes;
}
bool fitsInCache;
const QImage img = QgsApplication::imageCache()->pathAsImage( placeholderImage, QSize(), false, 1.0, fitsInCache );
nodes << new QgsImageLegendNode( nodeLayer, img );
return nodes;
}

QgsFeatureRenderer *r = mLayer->renderer();
Expand Down
2 changes: 1 addition & 1 deletion src/core/vector/qgsvectorlayerprofilegenerator.cpp
Expand Up @@ -536,7 +536,7 @@ void QgsVectorLayerProfileResults::renderResultsAsIndividualFeatures( QgsProfile

renderer->stopRender( context.renderContext() );
}
else
else if ( mLayer )
{
QSet<QString> attributes;
attributes.unite( mMarkerSymbol->usedAttributes( context.renderContext() ) );
Expand Down
5 changes: 4 additions & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp
Expand Up @@ -145,7 +145,10 @@ void QgsRelationReferenceWidgetWrapper::showIndeterminateState()

QVariantList QgsRelationReferenceWidgetWrapper::additionalFieldValues() const
{
if ( !mWidget || !mWidget->relation().isValid() )
if ( !mWidget )
return {};

if ( !mWidget->relation().isValid() )
{
QVariantList values;
for ( int i = 0; i < mWidget->relation().fieldPairs().count(); i++ )
Expand Down
3 changes: 1 addition & 2 deletions src/gui/mesh/qgsmeshlayerproperties.cpp
Expand Up @@ -216,8 +216,7 @@ void QgsMeshLayerProperties::syncToLayer()
mLayerOrigNameLineEd->setText( mMeshLayer->name() );
whileBlocking( mCrsSelector )->setCrs( mMeshLayer->crs() );

if ( mMeshLayer )
mDatasetGroupTreeWidget->syncToLayer( mMeshLayer );
mDatasetGroupTreeWidget->syncToLayer( mMeshLayer );

QgsDebugMsgLevel( QStringLiteral( "populate config tab" ), 4 );
for ( QgsMapLayerConfigWidget *w : std::as_const( mConfigWidgets ) )
Expand Down

0 comments on commit 3ab993f

Please sign in to comment.