Skip to content

Commit f4545d9

Browse files
committedMay 31, 2014
fix crash in postgres layer creation (followup 3470b1d; fixes #10014)
1 parent 873ec8c commit f4545d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ bool QgsPostgresProvider::convertField( QgsField &field , const QMap<QString, QV
27802780
{
27812781
//determine field type to use for strings
27822782
QString stringFieldType = "varchar";
2783-
if ( options->contains( "dropStringConstraints" ) && options->value( "dropStringConstraints" ).toBool() )
2783+
if ( options && options->value( "dropStringConstraints", false ).toBool() )
27842784
{
27852785
//drop string length constraints by using PostgreSQL text type for strings
27862786
stringFieldType = "text";
@@ -2970,7 +2970,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
29702970
throw PGException( result );
29712971
}
29722972

2973-
if ( options->contains( "lowercaseFieldNames" ) && options->value( "lowercaseFieldNames" ).toBool() )
2973+
if ( options && options->value( "lowercaseFieldNames", false ).toBool() )
29742974
{
29752975
//convert primary key name to lowercase
29762976
//this must happen after determining the field type of the primary key
@@ -3065,7 +3065,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
30653065
continue;
30663066
}
30673067

3068-
if ( options->contains( "lowercaseFieldNames" ) && options->value( "lowercaseFieldNames" ).toBool() )
3068+
if ( options && options->value( "lowercaseFieldNames", false ).toBool() )
30693069
{
30703070
//convert field name to lowercase
30713071
fld.setName( fld.name().toLower() );

0 commit comments

Comments
 (0)
Please sign in to comment.