commit | e5364f93d3208a66d599d7256d2e4cfaba989e0e | [log] [tgz] |
---|---|---|
author | Felix Oghina <hackz@google.com> | Wed Feb 15 15:32:51 2023 +0000 |
committer | Sergey Volnov <volnov@google.com> | Thu Sep 14 17:26:33 2023 +0000 |
tree | f7b491e2eacaadeb19e835ff613fc801a71ded31 | |
parent | f0ebf508416f19a7e30b89c4f6aea669db0fb6a0 [diff] |
Fix NPE in TTS service if no engine string Test: added test in TextToSpeechServiceTest Bug: 232438498 Change-Id: Ia587d34e2898930c0956024c56a1f19debb445e4
diff --git a/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java b/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java index 9015563..2411498 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 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) {