do not call value() on empty optional query_info

This commit is contained in:
Sema Checherinda 2024-02-02 18:44:01 +01:00
parent 89bcebfe96
commit 8581bdbe58

View File

@ -419,7 +419,11 @@ namespace
void read(GRPCQueryInfo & query_info_, const CompletionCallback & callback) override void read(GRPCQueryInfo & query_info_, const CompletionCallback & callback) override
{ {
if (!query_info.has_value()) if (!query_info.has_value())
{
callback(false); callback(false);
return;
}
query_info_ = std::move(query_info).value(); query_info_ = std::move(query_info).value();
query_info.reset(); query_info.reset();
callback(true); callback(true);
@ -486,7 +490,11 @@ namespace
void read(GRPCQueryInfo & query_info_, const CompletionCallback & callback) override void read(GRPCQueryInfo & query_info_, const CompletionCallback & callback) override
{ {
if (!query_info.has_value()) if (!query_info.has_value())
{
callback(false); callback(false);
return;
}
query_info_ = std::move(query_info).value(); query_info_ = std::move(query_info).value();
query_info.reset(); query_info.reset();
callback(true); callback(true);