Skip to content

Commit

Permalink
postgis: avoid potential crash if connection is not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Apr 2, 2013
1 parent 42d7263 commit c6fd387
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/input/postgis/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Connection
{
std::ostringstream s;
s << "Postgis Plugin: ";
if (conn_ )
if (conn_)
{
std::string msg = PQerrorMessage(conn_);
if (! msg.empty())
Expand All @@ -64,14 +64,13 @@ class Connection
{
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());
}
}
Expand Down

0 comments on commit c6fd387

Please sign in to comment.