summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-09-15 16:08:42 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-09-15 16:08:42 +0000
commita3f36b1e6f5087bb43b44b23cd1d53e7fc715950 (patch)
tree455f28cb4c711cdb2770e50233933821fb90870c
parent5b51a6b11bd88ce07ff087c151a6566360b5d61e (diff)
parent21f971c35316e9aa70e04510b3a6404a9cc3e3c5 (diff)
Merge "Fix NPE in TTS service if no engine string" into udc-qpr-dev
-rw-r--r--services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerService.java6
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) {