Make DetectEncoding() failed when ucsdet_detect() returls NULL.

In some cases, DetectEncoding() crashes and the reason may be becasue
ucsdet_detect() returns NULL with no error status.
(cf. http://crosbug.com/15691)

BUG=http://crosbug.com/15691
TEST=none

Review URL: http://codereview.chromium.org/7064039

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86509 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: f7e7ed6aaf600d99e9db6a4af51eec9d8983cb84
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 @@
   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);