diff options
author | Andras Timar <andras.timar@collabora.com> | 2020-06-19 11:05:36 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-06-19 11:46:04 +0200 |
commit | 7d932fa99219e2395e169941f96f94452c2f6bb6 (patch) | |
tree | e01664b4a028b87fa7e9bc460e6bf1f5d52337d0 | |
parent | 459134ea842ad8238ab3c4efffef26843a3853c9 (diff) |
Fix a chrash in LOKit (Japanese-only)
Change-Id: I09c8d3a129c0d1d2fab561add0447869156b193f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96682
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | i18npool/source/collator/collator_unicode.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index b731d8879fed..c9d696fc6046 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -393,6 +393,11 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale), "", rAlgorithm.isEmpty() ? OUString("") : "collation=" + rAlgorithm)); + // FIXME: apparently we get here in LOKit case only. When the language is Japanese, we pass "ja@collation=phonetic (alphanumeric first)" to ICU + // and ICU does not like this (U_ILLEGAL_ARGUMENT_ERROR). Subsequently LOKit crashes, because collator is nullptr. + if (!strcmp(icuLocale.getLanguage(), "ja")) + icuLocale = icu::Locale::getJapanese(); + // load ICU collator collator.reset( static_cast<icu::RuleBasedCollator*>( icu::Collator::createInstance(icuLocale, status) ) ); if (! U_SUCCESS(status)) { |