From 04f93ab46c8c5057bac3bdd5241f049907bf653f Mon Sep 17 00:00:00 2001 From: Josip Mrden <josip.mrden@memgraph.io> Date: Thu, 21 Mar 2024 15:21:51 +0100 Subject: [PATCH] Add support when query returns nothing --- src/query/procedure/mg_procedure_impl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/query/procedure/mg_procedure_impl.cpp b/src/query/procedure/mg_procedure_impl.cpp index aa25538c7..9778ad1b0 100644 --- a/src/query/procedure/mg_procedure_impl.cpp +++ b/src/query/procedure/mg_procedure_impl.cpp @@ -4132,6 +4132,10 @@ mgp_error mgp_pull_one(mgp_execution_result *exec_result, mgp_graph *graph, mgp_ MgProcedureResultStream stream(memory); exec_result->pImpl->interpreter->Pull(&stream, 1, {}); + if (stream.rows.empty()) { + throw std::out_of_range("Out of range pull since query does not remove anything!"); + } + const size_t headers_size = exec_result->pImpl->headers->headers.size(); memgraph::utils::pmr::map<memgraph::utils::pmr::string, mgp_value> items(memory->impl); for (size_t idx = 0; idx < headers_size; idx++) {