From e212514bbfa06b250e638f6821deb944b24ff0c7 Mon Sep 17 00:00:00 2001 From: sin-ack Date: Sun, 20 Mar 2022 00:40:47 +0000 Subject: [PATCH] LookupServer: Return with failure result when lookup fails This was missed in 4ca0669d1e732b1697a7944a7899b2250bb81cf1 and the error condition would still fall through to an ErrorOr unwrapping which caused a crash. --- Userland/Services/LookupServer/ConnectionFromClient.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Services/LookupServer/ConnectionFromClient.cpp b/Userland/Services/LookupServer/ConnectionFromClient.cpp index 4617f8b1f70..09a5e6771a6 100644 --- a/Userland/Services/LookupServer/ConnectionFromClient.cpp +++ b/Userland/Services/LookupServer/ConnectionFromClient.cpp @@ -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();