postgis: avoid potential crash if connection is not initialized
This commit is contained in:
parent
42d7263cab
commit
c6fd387469
1 changed files with 2 additions and 3 deletions
|
@ -53,7 +53,7 @@ public:
|
|||
{
|
||||
std::ostringstream s;
|
||||
s << "Postgis Plugin: ";
|
||||
if (conn_ )
|
||||
if (conn_)
|
||||
{
|
||||
std::string msg = PQerrorMessage(conn_);
|
||||
if (! msg.empty())
|
||||
|
@ -64,14 +64,13 @@ public:
|
|||
{
|
||||
s << "unable to connect to postgres server";
|
||||
}
|
||||
PQfinish(conn_);
|
||||
}
|
||||
else
|
||||
{
|
||||
s << "unable to connect to postgres server";
|
||||
}
|
||||
s << "\n" << connection_str;
|
||||
|
||||
PQfinish(conn_);
|
||||
throw mapnik::datasource_exception(s.str());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue