Avoid double cache lookup in QHostInfoCache

Change-Id: If5ef2d2f117fe8c1abdf361f1122e32075e14385
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jędrzej Nowacki 2014-12-15 21:46:42 +01:00
parent 0d4485fd78
commit 9e53325cfc

View File

@ -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;