1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:07:46 +00:00

AK: Make HashMap::get(Key) return an Optional<Value>.

This allows HashMap::get() to be used for value types that cannot be default
constructed (e.g NonnullOwnPtr.)
This commit is contained in:
Andreas Kling 2019-07-24 10:25:43 +02:00
parent e2798d6208
commit 1d0b464618
10 changed files with 27 additions and 17 deletions

View file

@ -157,9 +157,9 @@ int main(int argc, char** argv)
for (auto& key : dns_custom_hostnames.keys()) {
dbgprintf("Known hostname: '%s'\n", key.characters());
}
if (dns_custom_hostnames.contains(hostname)) {
responses.append(dns_custom_hostnames.get(hostname));
dbgprintf("LookupServer: Found preconfigured host (from /etc/hosts): %s\n", responses[0].characters());
if (auto known_host = dns_custom_hostnames.get(hostname)) {
responses.append(known_host.value());
dbg() << "LookupServer: Found preconfigured host (from /etc/hosts): " << known_host.value();
} else if (!hostname.is_empty()) {
bool did_timeout;
int retries = 3;