fix: add optional chaining for safe access to voice_text_str in ASR response

This commit is contained in:
Harvey Zack committed 2025-05-23 10:12:29 +08:00
1 parent 3f0a1bd433
commit 62835bb042
1 file changed
+1 -1
+1 -1
View File
@@ -39,7 +39,7 @@ async function startAsr(buffer) {
ws.onmessage = (event) => {
const { code, result } = JSON.parse(event.data);
if (code === 0) {
art.plugins.artplayerPluginAsr.append(result.voice_text_str);
art.plugins.artplayerPluginAsr.append(result?.voice_text_str);
} else {
stopAsr();
}