From 4a60d61887a20d349e5eb38900dfbcaab06630fc Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 26 Jul 2010 16:11:58 -0700 Subject: [PATCH] Fix NPE in TextToSpeech with setLanguage(null) getLanguage() can return null, and pass it to setLanguage() in TextToSpeech.initTts() Change-Id: I8046e94959404bd63b0a90bcc2dbf4018f77c110 --- core/java/android/speech/tts/TextToSpeech.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 26c167e1f0133..841257f367701 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -1065,6 +1065,9 @@ public class TextToSpeech { if (!mStarted) { return result; } + if (loc == null) { + return result; + } try { String language = loc.getISO3Language(); String country = loc.getISO3Country();