From e3f5bcda17f07ae402d33fe3ae75b532c00c4f98 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Mon, 29 Feb 2016 15:49:17 +0300 Subject: [PATCH] [new downloader] Review fixes. --- storage/storage.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/storage/storage.cpp b/storage/storage.cpp index 3fd2400196..d16e936598 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -1309,16 +1309,16 @@ void Storage::GetNodeAttrs(TCountryId const & countryId, NodeAttrs & nodeAttrs) CalculateProgress(downloadingMwm, descendants, downloadingMwmProgress, setQueue); // Local mwm information. + nodeAttrs.m_localMwmCounter = 0; + nodeAttrs.m_localMwmSize = 0; node->ForEachInSubtree([this, &nodeAttrs](TCountriesContainer const & d) { - auto const localeMapIt = m_localFiles.find(d.Value().Name()); - if (localeMapIt != m_localFiles.end()) - { - nodeAttrs.m_localMwmCounter += 1; - list const & localMwmFiles = localeMapIt->second; - ASSERT_EQUAL(localMwmFiles.size(), 1, ("Storage::GetNodeAttrs is called for two component mwms.")); - nodeAttrs.m_localMwmSize += (*localMwmFiles.begin())->GetSize(MapOptions::Map); - } + Storage::TLocalFilePtr const localFile = GetLatestLocalFile(d.Value().Name()); + if (localFile == nullptr) + return; + + nodeAttrs.m_localMwmCounter += 1; + nodeAttrs.m_localMwmSize += localFile->GetSize(MapOptions::Map); }); // Parents information.