Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix Coverity null dereference warnings
  • Loading branch information
nyalldawson committed Apr 29, 2017
1 parent d2a7c93 commit 8593f3a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsexpression.cpp
Expand Up @@ -2242,7 +2242,7 @@ static QVariant fcnMakeCircle( const QVariantList &values, const QgsExpressionCo
parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) );
return QVariant();
}
QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( geom.geometry() );
QgsPointV2 *point = static_cast< QgsPointV2 * >( geom.geometry() );
QgsCircle circ( *point, radius );
return QVariant::fromValue( QgsGeometry( circ.toPolygon( segment ) ) );
}
Expand All @@ -2265,7 +2265,7 @@ static QVariant fcnMakeEllipse( const QVariantList &values, const QgsExpressionC
parent->setEvalErrorString( QObject::tr( "Segment must be greater than 2" ) );
return QVariant();
}
QgsPointV2 *point = dynamic_cast< QgsPointV2 * >( geom.geometry() );
QgsPointV2 *point = static_cast< QgsPointV2 * >( geom.geometry() );
QgsEllipse elp( *point, majorAxis, minorAxis, azimuth );
return QVariant::fromValue( QgsGeometry( elp.toPolygon( segment ) ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerimport.cpp
Expand Up @@ -103,7 +103,7 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
if ( providerKey == "ogr" )
{
QString layerName;
if ( options->contains( QStringLiteral( "layerName" ) ) )
if ( options && options->contains( QStringLiteral( "layerName" ) ) )
layerName = options->value( QStringLiteral( "layerName" ) ).toString();
if ( !layerName.isEmpty() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -256,7 +256,7 @@ QgsVectorLayerImport::ImportError QgsOgrProvider::createEmptyLayer( const QStrin
QgsVectorFileWriter::ActionOnExistingFile action( QgsVectorFileWriter::CreateOrOverwriteFile );
bool update = false;
if ( options->contains( QStringLiteral( "update" ) ) )
if ( options && options->contains( QStringLiteral( "update" ) ) )
{
update = options->value( QStringLiteral( "update" ) ).toBool();
if ( update )
Expand Down

0 comments on commit 8593f3a

Please sign in to comment.