From 04f6e7df1378d59adaada3099590d6c0fcef73a6 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Thu, 31 Oct 2024 12:09:19 -0400 Subject: [PATCH] handle case of null voices list --- lib/pangea/widgets/chat/tts_controller.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pangea/widgets/chat/tts_controller.dart b/lib/pangea/widgets/chat/tts_controller.dart index c98cb6220..baffb7b9b 100644 --- a/lib/pangea/widgets/chat/tts_controller.dart +++ b/lib/pangea/widgets/chat/tts_controller.dart @@ -45,8 +45,8 @@ class TtsController { await tts.awaitSpeakCompletion(true); - final voices = await tts.getVoices; - availableLangCodes = (voices as List) + final voices = (await tts.getVoices) as List?; + availableLangCodes = (voices ?? []) .map((v) { // on iOS / web, the codes are in 'locale', but on Android, they are in 'name' final nameCode = v['name']?.split("-").first;