diff --git a/Libraries/LibDNS/Resolver.h b/Libraries/LibDNS/Resolver.h index cdf39874f0f..73cbe55ed65 100644 --- a/Libraries/LibDNS/Resolver.h +++ b/Libraries/LibDNS/Resolver.h @@ -453,10 +453,11 @@ private: if (!lookup) return Error::from_string_literal("No pending lookup found for this message"); - lookup->repeat_timer->stop(); if (lookup->result.is_null()) return {}; // Message is a response to a lookup that's been purged from the cache, ignore it + lookup->repeat_timer->stop(); + auto result = lookup->result.strong_ref(); for (auto& record : message.answers) result->add_record(move(record));