From: Vsevolod Stakhov Date: Sun, 13 Feb 2022 12:46:44 +0000 (+0000) Subject: [Minor] Improve error reporting X-Git-Tag: 3.2~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=192a5fd8bbf150ce515519477b466b3a811e8a30;p=thirdparty%2Frspamd.git [Minor] Improve error reporting Issue: #4076 --- diff --git a/src/libutil/cxx/utf8_util.cxx b/src/libutil/cxx/utf8_util.cxx index da68c990cf..8c727e9ad6 100644 --- a/src/libutil/cxx/utf8_util.cxx +++ b/src/libutil/cxx/utf8_util.cxx @@ -160,8 +160,14 @@ rspamd_normalise_unicode_inplace(char *start, size_t *len) struct rspamd_icu_collate_storage { icu::Collator* collator = nullptr; rspamd_icu_collate_storage() { - UErrorCode success = U_ZERO_ERROR; - collator = icu::Collator::createInstance(icu::Locale::getEnglish(), success); + UErrorCode uc_err = U_ZERO_ERROR; + collator = icu::Collator::createInstance(icu::Locale::getEnglish(), uc_err); + + if (U_FAILURE(uc_err) || collator == nullptr) { + g_error ("fatal error: cannot init libicu collation engine: %s", + u_errorName(uc_err)); + abort(); + } /* Ignore all difference except functional */ collator->setStrength(icu::Collator::PRIMARY); }