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:
authorvng <viktor.govako@gmail.com>2013-12-03 17:24:08 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:08:08 +0300
commit55d0f1c27fc406da2acc2e041c6f651139e4a0e4 (patch)
treef416350050f3b1ffc9d08b242809b7f41adaa64f /indexer/classificator.cpp
parentea31feaa16e09b1e05938128292c9a9f0a2668e7 (diff)
Show more diagnostics in case of invalid categories.txt file.
Diffstat (limited to 'indexer/classificator.cpp')
-rw-r--r--indexer/classificator.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp
index 01efd1174c..0e1288c9b6 100644
--- a/indexer/classificator.cpp
+++ b/indexer/classificator.cpp
@@ -363,7 +363,7 @@ void Classificator::SortClassificator()
GetMutableRoot()->Sort();
}
-uint32_t Classificator::GetTypeByPath(vector<string> const & path) const
+uint32_t Classificator::GetTypeByPathSafe(vector<string> const & path) const
{
ClassifObject const * p = GetRoot();
@@ -373,7 +373,8 @@ uint32_t Classificator::GetTypeByPath(vector<string> const & path) const
while (i < path.size())
{
ClassifObjectPtr ptr = p->BinaryFind(path[i]);
- ASSERT ( ptr, ("Invalid path in Classificator::GetTypeByPath", path) );
+ if (!ptr)
+ return 0;
ftype::PushValue(type, ptr.GetIndex());
@@ -384,6 +385,13 @@ uint32_t Classificator::GetTypeByPath(vector<string> const & path) const
return type;
}
+uint32_t Classificator::GetTypeByPath(vector<string> const & path) const
+{
+ uint32_t const type = GetTypeByPathSafe(path);
+ ASSERT_NOT_EQUAL(type, 0, (path));
+ return type;
+}
+
void Classificator::ReadTypesMapping(istream & s)
{
m_mapping.Load(s);