From cb066d59f5394beb88ac5b92c8a6db51494c9799 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 21 Apr 2023 21:32:27 +0100 Subject: Don't use &vector.front() for vector which might be empty Instead just use .data() which safely returns something which might be nullptr, but that's fine. --- libpqpp/pq-bulkselectcommand.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libpqpp/pq-bulkselectcommand.cpp') diff --git a/libpqpp/pq-bulkselectcommand.cpp b/libpqpp/pq-bulkselectcommand.cpp index 8c9e1f0..298261e 100644 --- a/libpqpp/pq-bulkselectcommand.cpp +++ b/libpqpp/pq-bulkselectcommand.cpp @@ -18,8 +18,8 @@ void PQ::BulkSelectCommand::execute() { if (!executed) { - execRes = c->checkResult(PQexecPrepared(c->conn, prepare(), static_cast(values.size()), &values.front(), - &lengths.front(), &formats.front(), binary), + execRes = c->checkResult(PQexecPrepared(c->conn, prepare(), static_cast(values.size()), values.data(), + lengths.data(), formats.data(), binary), PGRES_TUPLES_OK); nTuples = static_cast(PQntuples(execRes)); tuple = static_cast(-1); -- cgit v1.2.3