Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3566)

Unified Diff: base/i18n/icu_encoding_detection.cc

Issue 7064039: Make DetectEncoding() failed when ucsdet_detect() returls NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/icu_encoding_detection.cc
diff --git a/base/i18n/icu_encoding_detection.cc b/base/i18n/icu_encoding_detection.cc
index 3583fa9c5f7436ef02b61e177bc433b488fdc0e6..ce7a372fe13710a36650203765a5439249213c02 100644
--- a/base/i18n/icu_encoding_detection.cc
+++ b/base/i18n/icu_encoding_detection.cc
@@ -22,6 +22,10 @@ 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);
+ // In case that ucsdet_detect() returns NULL with no error
+ // http://crosbug.com/15691
zel 2011/05/24 22:46:48 Please remove this comment, no need for that.
+ if (match == NULL)
+ return false;
const char* detected_encoding = ucsdet_getName(match, &status);
ucsdet_close(detector);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698