From 9e53325cfc9c099c344327e12f59f2e1f5a0a9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 15 Dec 2014 21:46:42 +0100 Subject: [PATCH] Avoid double cache lookup in QHostInfoCache Change-Id: If5ef2d2f117fe8c1abdf361f1122e32075e14385 Reviewed-by: Thiago Macieira --- src/network/kernel/qhostinfo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index a9a80054f4..68752660ba 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -724,8 +724,7 @@ QHostInfo QHostInfoCache::get(const QString &name, bool *valid) QMutexLocker locker(&this->mutex); *valid = false; - if (cache.contains(name)) { - QHostInfoCacheElement *element = cache.object(name); + if (QHostInfoCacheElement *element = cache.object(name)) { if (element->age.elapsed() < max_age*1000) *valid = true; return element->info;