aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-01-21 09:54:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-01-21 09:54:59 +0200
commit56c25c1fac02bceac4f46625df95a26cfcced1a4 (patch)
treedaa7e5d3c2f28ac501856c23d01d1349a4abde65
parent5bb7804d830345ebf06cecc4bf9a7c40dc184453 (diff)
Make error translation more robust
-rw-r--r--odb/pgsql/error.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/odb/pgsql/error.cxx b/odb/pgsql/error.cxx
index c7a7833..9e56ee2 100644
--- a/odb/pgsql/error.cxx
+++ b/odb/pgsql/error.cxx
@@ -51,7 +51,11 @@ namespace odb
}
case PGRES_FATAL_ERROR:
{
- string ss (PQresultErrorField (r, PG_DIAG_SQLSTATE));
+ string ss;
+ {
+ const char* s (PQresultErrorField (r, PG_DIAG_SQLSTATE));
+ ss = (s != 0 ? s : "?????");
+ }
// Deadlock detected.
//