Fix some Coverity null pointer dereference warnings

This commit is contained in:
Nyall Dawson 2017-09-01 07:54:20 +10:00
parent 9a07cd513a
commit e7ddfff09d
2 changed files with 2 additions and 2 deletions

View File

@ -2037,7 +2037,7 @@ bool QgsAttributeForm::fieldIsEditable( int fieldIndex ) const
int srcFieldIndex;
const QgsVectorLayerJoinInfo *info = mLayer->joinBuffer()->joinForFieldIndex( fieldIndex, mLayer->fields(), srcFieldIndex );
if ( !info->hasUpsertOnEdit() && mMode == QgsAttributeForm::AddFeatureMode )
if ( info && !info->hasUpsertOnEdit() && mMode == QgsAttributeForm::AddFeatureMode )
editable = false;
else if ( info && info->isEditable() && info->joinLayer()->isEditable() )
editable = fieldIsEditable( *( info->joinLayer() ), srcFieldIndex, mFeature.id() );

View File

@ -383,7 +383,7 @@ bool QgsGeoPackageConnectionItem::handleDrop( const QMimeData *data, Qt::DropAct
{
if ( isVector ) // Import vectors and aspatial
{
QgsVectorLayer *vectorSrcLayer = dynamic_cast < QgsVectorLayer * >( srcLayer );
QgsVectorLayer *vectorSrcLayer = qobject_cast < QgsVectorLayer * >( srcLayer );
QVariantMap options;
options.insert( QStringLiteral( "driverName" ), QStringLiteral( "GPKG" ) );
options.insert( QStringLiteral( "update" ), true );