]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve error reporting
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 13 Feb 2022 12:46:44 +0000 (12:46 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 13 Feb 2022 12:46:44 +0000 (12:46 +0000)
Issue: #4076

src/libutil/cxx/utf8_util.cxx

index da68c990cf906efe54c2ff7190555072a51d7a56..8c727e9ad6a3f7f1f50d6b3500843b2017c62c25 100644 (file)
@@ -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);
        }