diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 8895f81add1..a1c946bccd2 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -2091,8 +2091,9 @@ PQgetResult(PGconn *conn) res = pqPrepareAsyncResult(conn); /* Advance the queue as appropriate */ - pqCommandQueueAdvance(conn, false, - res->resultStatus == PGRES_PIPELINE_SYNC); + if (res) + pqCommandQueueAdvance(conn, false, + res->resultStatus == PGRES_PIPELINE_SYNC); if (conn->pipelineStatus != PQ_PIPELINE_OFF) {