Skip to content
Permalink
Browse files

fix crash in postgres layer creation (followup 3470b1d; fixes #10014)

  • Loading branch information
jef-n committed May 31, 2014
1 parent 873ec8c commit f4545d9dec81ca7d57b1a8b3cafb19b50e78f9b8
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/providers/postgres/qgspostgresprovider.cpp
@@ -2780,7 +2780,7 @@ bool QgsPostgresProvider::convertField( QgsField &field , const QMap<QString, QV
{
//determine field type to use for strings
QString stringFieldType = "varchar";
if ( options->contains( "dropStringConstraints" ) && options->value( "dropStringConstraints" ).toBool() )
if ( options && options->value( "dropStringConstraints", false ).toBool() )
{
//drop string length constraints by using PostgreSQL text type for strings
stringFieldType = "text";
@@ -2970,7 +2970,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
throw PGException( result );
}

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

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

0 comments on commit f4545d9

Please sign in to comment.
You can’t perform that action at this time.