From bfdb2314bfba4a1c599612eddb8b1c86f28311e0 Mon Sep 17 00:00:00 2001 From: vng Date: Tue, 5 Aug 2014 17:36:57 +0300 Subject: [PATCH] Fixed bug in matching categories for one-word classificator type. --- search/search_engine.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/search/search_engine.cpp b/search/search_engine.cpp index 958ed0ec54..6ad4f9e235 100644 --- a/search/search_engine.cpp +++ b/search/search_engine.cpp @@ -402,12 +402,19 @@ string Engine::GetCountryName(string const & id) bool Engine::GetNameByType(uint32_t type, int8_t locale, string & name) const { uint8_t level = ftype::GetLevel(type); - while (level >= 2) + ASSERT_GREATER(level, 0, ()); + + while (true) { if (m_pData->m_categories.GetNameByType(type, locale, name)) return true; - ftype::TruncValue(type, --level); + + if (--level == 0) + break; + + ftype::TruncValue(type, level); } + return false; }