LookupServer: Return with failure result when lookup fails

This was missed in 4ca0669d1e and the
error condition would still fall through to an ErrorOr unwrapping which
caused a crash.
This commit is contained in:
sin-ack 2022-03-20 00:40:47 +00:00 committed by Ali Mohammad Pur
parent 82a515a748
commit e212514bbf
Notes: sideshowbarker 2024-07-17 17:03:48 +09:00

View file

@ -33,6 +33,7 @@ Messages::LookupServer::LookupNameResponse ConnectionFromClient::lookup_name(Str
auto maybe_answers = LookupServer::the().lookup(name, DNSRecordType::A);
if (maybe_answers.is_error()) {
dbgln("LookupServer: Failed to lookup PTR record: {}", maybe_answers.error());
return { 1, {} };
}
auto answers = maybe_answers.release_value();
@ -57,6 +58,7 @@ Messages::LookupServer::LookupAddressResponse ConnectionFromClient::lookup_addre
auto maybe_answers = LookupServer::the().lookup(name, DNSRecordType::PTR);
if (maybe_answers.is_error()) {
dbgln("LookupServer: Failed to lookup PTR record: {}", maybe_answers.error());
return { 1, String() };
}
auto answers = maybe_answers.release_value();