Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Zolotarev <alex@maps.me>2015-08-22 01:35:34 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:02:20 +0300
commit0d858a4023a08af3df4175c7f38e74bef01eebe7 (patch)
tree23bb7ba377aafc29e414e7120139aa9f6af2a92c /platform
parentcf1a4f085abcc9c495ffb7b2a5ccfcb45f467db5 (diff)
Correct crash fix for missing navigation sounds file. Full path does not work, because the path is always relative (for assets inside APK for Android or to resources folder on iOS).
Diffstat (limited to 'platform')
-rw-r--r--platform/get_text_by_id.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/platform/get_text_by_id.cpp b/platform/get_text_by_id.cpp
index 593e1f0beb..9abda6c21d 100644
--- a/platform/get_text_by_id.cpp
+++ b/platform/get_text_by_id.cpp
@@ -38,14 +38,16 @@ GetTextById::GetTextById(TextSource textSouce, string const & localeName)
{GetTextSourceString(textSouce), localeName + ".json"}, "localize.json");
// @TODO(vbykoianko) Add assert if locale path pathToJson is not valid.
- LOG(LDEBUG, ("Trying to open json file at path", pathToJson));
- if (!GetPlatform().IsFileExistsByFullPath(pathToJson))
+ string jsonBuffer;
+ try
+ {
+ GetPlatform().GetReader(pathToJson)->ReadAsString(jsonBuffer);
+ }
+ catch (RootException const & ex)
{
- LOG(LWARNING, ("Sound instructions test file not exists!"));
+ LOG(LWARNING, ("Can't open sound instructions file", pathToJson, ex.what()));
return;
}
- string jsonBuffer;
- ReaderPtr<Reader>(GetPlatform().GetReader(pathToJson)).ReadAsString(jsonBuffer);
InitFromJson(jsonBuffer);
}