From 5a12988bc7a6db3d82859c9c3f47b503804b5705 Mon Sep 17 00:00:00 2001 From: vng Date: Tue, 3 Dec 2013 14:24:28 +0100 Subject: [PATCH] Correct guides info loading. --- storage/guides.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/storage/guides.cpp b/storage/guides.cpp index 8e4577304e..65f8087b5a 100644 --- a/storage/guides.cpp +++ b/storage/guides.cpp @@ -95,20 +95,26 @@ bool GuidesManager::RestoreFromFile() int resourcesVersion = -1, downloadedVersion = -1; MapT fromResources, fromDownloaded; + // Do not merge this blocks into one try-catch. Try to read from 2 sources independently. + Platform & pl = GetPlatform(); try { - Platform & pl = GetPlatform(); - string json; ReaderPtr(pl.GetReader(GetDataFileName(), "r")).ReadAsString(json); resourcesVersion = ParseGuidesData(json, fromResources); + } + catch (RootException const &) + { + } + try + { + string json; ReaderPtr(pl.GetReader(GetDataFileName(), "w")).ReadAsString(json); downloadedVersion = ParseGuidesData(json, fromDownloaded); } - catch (RootException const & ex) + catch (RootException const &) { - LOG(LWARNING, ("Failed to read guide info file:", ex.Msg())); } if (downloadedVersion > resourcesVersion) @@ -122,7 +128,7 @@ bool GuidesManager::RestoreFromFile() return true; } - LOG(LWARNING, ("Guides descriptions were not loaded")); + LOG(LWARNING, ("Guides descriptions were not loaded from bundle")); return false; }