OSDN Git Service

Fix bug 2446811 Ensure the default locale is never constructed
authorJean-Michel Trivi <jmtrivi@google.com>
Wed, 17 Feb 2010 20:50:44 +0000 (12:50 -0800)
committerJean-Michel Trivi <jmtrivi@google.com>
Wed, 17 Feb 2010 20:50:44 +0000 (12:50 -0800)
 with a null string.

src/com/android/settings/TextToSpeechSettings.java

index 86f9919..3c55d10 100644 (file)
@@ -265,9 +265,15 @@ public class TextToSpeechSettings extends PreferenceActivity implements
         if (status == TextToSpeech.SUCCESS) {
             Log.v(TAG, "TTS engine for settings screen initialized.");
             mEnableDemo = true;
-            if (mDefaultLanguage == null){
+            if (mDefaultLanguage == null) {
                 mDefaultLanguage = Locale.getDefault().getISO3Language();
             }
+            if (mDefaultCountry == null) {
+                mDefaultCountry = Locale.getDefault().getISO3Country();
+            }
+            if (mDefaultLocVariant == null) {
+                mDefaultLocVariant = new String();
+            }
             mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant));
             mTts.setSpeechRate((float)(mDefaultRate/100.0f));
         } else {