Bug 1513912 - Null check return from TextToSpeech.getFeatures(). r=agi, a=jcristau FIREFOX_64_0_2_BUILD1 FIREFOX_64_0_2_RELEASE
authorEitan Isaacson <eitan@monotonous.org>
Thu, 20 Dec 2018 16:03:00 -0500
changeset 501491 c58ea2229c33
parent 501490 97f7aec00819
child 501492 65621d0fe126
child 501495 62c1a96d83a0
push id1891
push userjcristau@mozilla.com
push dateTue, 08 Jan 2019 16:05:30 +0000
treeherdermozilla-release@c58ea2229c33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersagi, jcristau
bugs1513912
milestone64.0.2
Bug 1513912 - Null check return from TextToSpeech.getFeatures(). r=agi, a=jcristau
mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SpeechSynthesisService.java
@@ -48,20 +48,22 @@ public class SpeechSynthesisService  {
             }
         });
     }
 
     private static void registerVoicesByLocale() {
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
-                Locale defaultLocale = sTTS.getDefaultLanguage();
+                Locale defaultLocale = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
+                        ? sTTS.getDefaultLanguage()
+                        : sTTS.getLanguage();
                 for (Locale locale : getAvailableLanguages()) {
                     final Set<String> features = sTTS.getFeatures(locale);
-                    boolean isLocal = features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
+                    boolean isLocal = features != null && features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
                     String localeStr = locale.toString();
                     registerVoice("moz-tts:android:" + localeStr, locale.getDisplayName(), localeStr.replace("_", "-"), !isLocal, defaultLocale == locale);
                 }
                 doneRegisteringVoices();
             }
         });
     }