Fix bug related to EdgeType and Label getters in query modules (#582)

Co-authored-by: Kostas Kyrimis <kostaskyrim@gmail.com>
This commit is contained in:
Antonio Filipovic 2022-10-06 21:21:11 +02:00 committed by GitHub
parent 68e7fd3d36
commit 417cf4b30b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1846,7 +1846,8 @@ mgp_error mgp_vertex_label_at(mgp_vertex *v, size_t i, mgp_label *result) {
"Expected LabelToName to return a pointer or reference, so we "
"don't have to take a copy and manage memory.");
const auto &name = std::visit([label](const auto *impl) { return impl->LabelToName(label); }, v->graph->impl);
const auto &name = std::visit(
[label](const auto *impl) -> const std::string & { return impl->LabelToName(label); }, v->graph->impl);
return name.c_str();
},
&result->name);
@ -2157,8 +2158,9 @@ mgp_error mgp_edge_equal(mgp_edge *e1, mgp_edge *e2, int *result) {
mgp_error mgp_edge_get_type(mgp_edge *e, mgp_edge_type *result) {
return WrapExceptions(
[e] {
const auto &name =
std::visit([e](const auto *impl) { return impl->EdgeTypeToName(e->impl.EdgeType()); }, e->from.graph->impl);
const auto &name = std::visit(
[e](const auto *impl) -> const std::string & { return impl->EdgeTypeToName(e->impl.EdgeType()); },
e->from.graph->impl);
return name.c_str();
},
&result->name);