summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmazzoni@google.com <dmazzoni@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-19 05:34:06 +0000
committerdmazzoni@google.com <dmazzoni@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-19 05:34:06 +0000
commit0bed46a38e2e8b88b252f157713e7cbb6fd9f909 (patch)
tree3530b74466ecf6a84c64e0c884cf7708602b542b
parent4f50840940c39cebfab32ef22ad48a05dcda87e8 (diff)
downloadchromium_src-0bed46a38e2e8b88b252f157713e7cbb6fd9f909.zip
chromium_src-0bed46a38e2e8b88b252f157713e7cbb6fd9f909.tar.gz
chromium_src-0bed46a38e2e8b88b252f157713e7cbb6fd9f909.tar.bz2
Merge 288680 "Wrap a try/catch around a call to TextToSpeech.isL..."
> Wrap a try/catch around a call to TextToSpeech.isLanguageAvailable > > BUG=397686 > > Review URL: https://codereview.chromium.org/429423003 TBR=dmazzoni@chromium.org Review URL: https://codereview.chromium.org/489443002 git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@290500 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java
index 7e43f06..d2f9e06 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java
@@ -250,13 +250,17 @@ class TtsPlatformImpl {
mVoices = new ArrayList<TtsVoice>();
for (int i = 0; i < locales.length; ++i) {
if (!locales[i].getVariant().isEmpty()) continue;
- if (mTextToSpeech.isLanguageAvailable(locales[i]) > 0) {
- String name = locales[i].getDisplayLanguage();
- if (!locales[i].getCountry().isEmpty()) {
- name += " " + locales[i].getDisplayCountry();
+ try {
+ if (mTextToSpeech.isLanguageAvailable(locales[i]) > 0) {
+ String name = locales[i].getDisplayLanguage();
+ if (!locales[i].getCountry().isEmpty()) {
+ name += " " + locales[i].getDisplayCountry();
+ }
+ TtsVoice voice = new TtsVoice(name, locales[i].toString());
+ mVoices.add(voice);
}
- TtsVoice voice = new TtsVoice(name, locales[i].toString());
- mVoices.add(voice);
+ } catch (java.util.MissingResourceException e) {
+ // Just skip the locale if it's invalid.
}
}