diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2009-08-10 16:13:18 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2009-08-11 15:09:45 -0700 |
commit | 69e67a3e2e863fa8828151ef3a488bfcaa504f7a (patch) | |
tree | fb2a4bdd477897d11f49eab36a0251481759ee72 /core/java/android | |
parent | 021fa3fa6fe88c33ad11a3139ebcd3a5be8eb953 (diff) | |
download | frameworks_base-69e67a3e2e863fa8828151ef3a488bfcaa504f7a.zip frameworks_base-69e67a3e2e863fa8828151ef3a488bfcaa504f7a.tar.gz frameworks_base-69e67a3e2e863fa8828151ef3a488bfcaa504f7a.tar.bz2 |
Fix bug 2043140.
A race condition is encountered when an application invokes shutdown()
on its TextToSpeech object while is has speak() requests still running.
Since the TTS service destructor releases the synthesizer resources and
sets the corresponding synth reference to null, an NPE was observed.
The fix consists in catching NPEs whenever the sNativeSynth object is
accessed, and return the matching error for the call.
This change is a "low risk" version of the fix for bug 2025765i (same
issue) which was reverted because it was higher risk than this CL:
it affected the logic of each call to sNativeSynth. This CL only sets
an error code when an NPE is fired because sNativeSynth is null.
Diffstat (limited to 'core/java/android')
-rwxr-xr-x | core/java/android/speech/tts/TextToSpeech.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 04a0ec8..4405a53 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -1032,7 +1032,7 @@ public class TextToSpeech { } try { String[] locStrings = mITts.getLanguage(); - if (locStrings.length == 3) { + if ((locStrings != null) && (locStrings.length == 3)) { return new Locale(locStrings[0], locStrings[1], locStrings[2]); } else { return null; |