diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index 1bcf42562e868..a871437dae7d3 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -1223,7 +1223,7 @@ nsDNSService::Observe(nsISupports* subject, const char* topic, Shutdown(); } - if (flushCache) { + if (flushCache && mResolver) { mResolver->FlushCache(false); return NS_OK; } @@ -1293,6 +1293,7 @@ nsDNSService::GetDNSCacheEntries( NS_IMETHODIMP nsDNSService::ClearCache(bool aTrrToo) { + NS_ENSURE_TRUE(mResolver, NS_ERROR_NOT_INITIALIZED); mResolver->FlushCache(aTrrToo); return NS_OK; }