Skip to content

Commit

Permalink
Avoid cppcheck warning about potential nullptr dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed Mar 6, 2021
1 parent ec3fbaa commit 94052bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/app/qgsmaptoolannotation.cpp
Expand Up @@ -165,10 +165,12 @@ void QgsMapToolAnnotation::keyPressEvent( QKeyEvent *e )
void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent *e )
{
QgsMapCanvasAnnotationItem *item = selectedItem();
if ( !item || !item->annotation() )
if ( !item )
return;

QgsAnnotation *annotation = item->annotation();
if ( !annotation )
return;

if ( e->buttons() & Qt::LeftButton )
{
Expand Down
3 changes: 2 additions & 1 deletion src/core/pointcloud/qgspointclouddataprovider.cpp
Expand Up @@ -44,7 +44,8 @@ QgsPointCloudDataProvider::Capabilities QgsPointCloudDataProvider::capabilities(

bool QgsPointCloudDataProvider::hasValidIndex() const
{
return index() && index()->isValid();
QgsPointCloudIndex *lIndex = index();
return lIndex && lIndex->isValid();
}

QgsGeometry QgsPointCloudDataProvider::polygonBounds() const
Expand Down

0 comments on commit 94052bc

Please sign in to comment.