commit 192a5fd: [Minor] Improve error reporting
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Feb 13 12:49:04 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-02-13 12:46:44 +0000
URL: https://github.com/rspamd/rspamd/commit/192a5fd8bbf150ce515519477b466b3a811e8a30 (HEAD -> master)
[Minor] Improve error reporting
Issue: #4076
---
src/libutil/cxx/utf8_util.cxx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/libutil/cxx/utf8_util.cxx b/src/libutil/cxx/utf8_util.cxx
index da68c990c..8c727e9ad 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);
}
More information about the Commits
mailing list