diff options
-rw-r--r-- | i18npool/source/languagetag/languagetag.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index cc9fc557ab0d..7f3c15e77d3a 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -584,7 +584,14 @@ rtl::OUString LanguageTag::getRegionFromLangtag() const if (maBcp47.isEmpty()) return aRegion; const lt_region_t* pRegionT = lt_tag_get_region( MPLANGTAG); - SAL_WARN_IF( !pRegionT, "i18npool.langtag", "LanguageTag::getRegionFromLangtag: pRegionT==NULL"); + // pRegionT==NULL is valid for language only tags, rough check here that + // does not take sophisticated tags into account that actually should have + // a region, check for ll, lll, ll-Ssss and lll-Ssss so that ll-CC and + // lll-CC actually fail. + SAL_WARN_IF( !pRegionT && + maBcp47.getLength() != 2 && maBcp47.getLength() != 3 && + maBcp47.getLength() != 7 && maBcp47.getLength() != 8, + "i18npool.langtag", "LanguageTag::getRegionFromLangtag: pRegionT==NULL"); if (!pRegionT) return aRegion; const char* pRegion = lt_region_get_tag( pRegionT); |