[DialogProcessor] update say method nullability (#2780)

Signed-off-by: Miguel Álvarez Díez <miguelwork92@gmail.com>
pull/2787/head
GiviMAD 2022-02-19 14:01:41 +01:00 committed by GitHub
parent f411561b70
commit 0e0adcbb8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -249,10 +249,7 @@ public class DialogProcessor implements KSListener, STTListener {
String question = sre.getTranscript();
try {
toggleProcessing(false);
String answer = hli.interpret(locale, question);
if (answer != null) {
say(answer);
}
say(hli.interpret(locale, question));
} catch (InterpretationException e) {
String msg = e.getMessage();
if (msg != null) {
@ -280,7 +277,11 @@ public class DialogProcessor implements KSListener, STTListener {
*
* @param text The text to say
*/
protected void say(String text) {
protected void say(@Nullable String text) {
if (text == null || text.isEmpty()) {
logger.debug("Empty value, nothing to say");
return;
}
try {
Voice voice = null;
for (Voice currentVoice : tts.getAvailableVoices()) {