Skip to content

Commit

Permalink
Guard for options null (other providers)
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jul 16, 2020
1 parent 9a17d93 commit 98496a2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -1839,7 +1839,7 @@ QgsVectorLayerExporter::ExportError QgsMssqlProvider::createEmptyLayer( const QS
{
// found, get the field type
QgsField fld = fields.at( i );
if ( (options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) || convertField( fld ) )
if ( ( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) || convertField( fld ) )
{
primaryKeyType = fld.typeName();
}
Expand Down Expand Up @@ -2019,7 +2019,7 @@ QgsVectorLayerExporter::ExportError QgsMssqlProvider::createEmptyLayer( const QS
continue;
}

if ( ! (options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) && !convertField( fld ) )
if ( !( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) && !convertField( fld ) )
{
if ( errorMessage )
*errorMessage = QObject::tr( "Unsupported type for field %1" ).arg( fld.name() );
Expand Down
4 changes: 2 additions & 2 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -2990,7 +2990,7 @@ QgsVectorLayerExporter::ExportError QgsOracleProvider::createEmptyLayer(
if ( idx >= 0 )
{
QgsField fld = fields.at( idx );
if ( (options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) || convertField( fld ) )
if ( ( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) || convertField( fld ) )
{
primaryKeyType = fld.typeName();
}
Expand Down Expand Up @@ -3243,7 +3243,7 @@ QgsVectorLayerExporter::ExportError QgsOracleProvider::createEmptyLayer(
continue;
}

if ( ! (options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) && ! convertField( fld ) )
if ( !( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) && ! convertField( fld ) )
{
errorMessage = QObject::tr( "Unsupported type for field %1" ).arg( fld.name() );

Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -4447,7 +4447,7 @@ QgsVectorLayerExporter::ExportError QgsPostgresProvider::createEmptyLayer( const
continue;
}

if ( ! (options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) && !convertField( fld, options ) )
if ( !( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) && !convertField( fld, options ) )
{
if ( errorMessage )
*errorMessage = QObject::tr( "Unsupported type for field %1" ).arg( fld.name() );
Expand Down
4 changes: 2 additions & 2 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -201,7 +201,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( const QString &uri,
{
// found it, get the field type
QgsField fld = fields.at( fldIdx );
if ( ( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) || convertField( fld ) )
if ( ( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) || convertField( fld ) )
{
primaryKeyType = fld.typeName();
}
Expand Down Expand Up @@ -416,7 +416,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( const QString &uri,
continue;
}

if ( ! ( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool()) && !convertField( fld ) )
if ( !( options && options->value( QStringLiteral( "skipConvertFields" ), false ).toBool() ) && !convertField( fld ) )
{
QgsDebugMsg( "error creating field " + fld.name() + ": unsupported type" );
if ( errorMessage )
Expand Down

0 comments on commit 98496a2

Please sign in to comment.