diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 21c203e8e7b903732eadb69eb75e9b71a571bcca..4c4f24f7d5abd46e72b33cf6ef068f3933a0f1b6 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -300,7 +300,8 @@ ConnectDatabase(Archive *AHX, /* check to see that the backend connection was successfully made */ if (PQstatus(AH->connection) == CONNECTION_BAD) exit_horribly(modulename, "connection to database \"%s\" failed: %s", - PQdb(AH->connection), PQerrorMessage(AH->connection)); + PQdb(AH->connection) ? PQdb(AH->connection) : "", + PQerrorMessage(AH->connection)); /* check for version mismatch */ _check_database_version(AH);