diff --git a/lib/modules/Sql.pmod/pgsql_util.pmod b/lib/modules/Sql.pmod/pgsql_util.pmod
index e1b4fff7e430a24347ccda586919cbdfa89201cd..b3e3f30113e7e2c802309e52e676e0100146da46 100644
--- a/lib/modules/Sql.pmod/pgsql_util.pmod
+++ b/lib/modules/Sql.pmod/pgsql_util.pmod
@@ -724,6 +724,8 @@ outer:
         int fd = -1;
         if (socket)
           catch(fd = socket->query_fd());
+        if (!this)				// Not in destructed objects
+          return "";
         res = predef::sprintf("conxion  fd: %d input queue: %d/%d "
                     "queued portals: %d  output queue: %d/%d\n"
                     "started: %d\n",
@@ -831,6 +833,8 @@ class sql_result {
         int fd = -1;
         if (c && c->socket)
           catch(fd = c->socket->query_fd());
+        if (!this)				// Not in destructed objects
+          return "";
         res = sprintf(
                       "sql_result state: %d numrows: %d eof: %d inflight: %d\n"
                       "fd: %O portalname: %O  coltypes: %d"