diff options
-rw-r--r-- | chrome/android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java | 16 |
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. } } |