do not segv if there is no postgres
authorChristian Grothoff <christian@grothoff.org>
Mon, 24 Feb 2020 22:48:47 +0000 (23:48 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 24 Feb 2020 22:48:47 +0000 (23:48 +0100)
src/pq/test_pq.c

index 7bcb1098077e7642f88de0c439a35bd3873ce299..b09354af89a8b2e6c826fddc2c7c5fb760d7ebe2 100644 (file)
@@ -238,6 +238,12 @@ main (int argc,
                           NULL,
                           es,
                           NULL);
+  if (NULL == db)
+  {
+    fprintf (stderr,
+             "Cannot run test, database connection failed\n");
+    return 77;
+  }
   if (CONNECTION_OK != PQstatus (db->conn))
   {
     fprintf (stderr,