diff options
| author | 2023-02-15 15:32:51 +0000 | |
|---|---|---|
| committer | 2023-09-14 17:26:33 +0000 | |
| commit | e5364f93d3208a66d599d7256d2e4cfaba989e0e (patch) | |
| tree | f7b491e2eacaadeb19e835ff613fc801a71ded31 | |
| parent | f0ebf508416f19a7e30b89c4f6aea669db0fb6a0 (diff) | |
Fix NPE in TTS service if no engine string
Test: added test in TextToSpeechServiceTest
Bug: 232438498
Change-Id: Ia587d34e2898930c0956024c56a1f19debb445e4
| -rw-r--r-- | services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java b/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java index 9015563f439e..24114988d6ba 100644 --- a/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java +++ b/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java @@ -63,6 +63,12 @@ public final class TextToSpeechManagerService extends public void createSession(String engine, ITextToSpeechSessionCallback sessionCallback) { synchronized (mLock) { + if (engine == null) { + runSessionCallbackMethod( + () -> sessionCallback.onError("Engine cannot be null")); + return; + } + TextToSpeechManagerPerUserService perUserService = getServiceForUserLocked( UserHandle.getCallingUserId()); if (perUserService != null) { |