summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/i18n/icu_encoding_detection.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/base/i18n/icu_encoding_detection.cc b/base/i18n/icu_encoding_detection.cc
index 3583fa9..2081c7a 100644
--- a/base/i18n/icu_encoding_detection.cc
+++ b/base/i18n/icu_encoding_detection.cc
@@ -22,6 +22,8 @@ bool DetectEncoding(const std::string& text, std::string* encoding) {
ucsdet_setText(detector, text.data(), static_cast<int32_t>(text.length()),
&status);
const UCharsetMatch* match = ucsdet_detect(detector, &status);
+ if (match == NULL)
+ return false;
const char* detected_encoding = ucsdet_getName(match, &status);
ucsdet_close(detector);