fix(tts): guard getVoices() against browser extension crash (Brave anti-fingerprinting, issue #61)

This commit is contained in:
dadaloop82
2026-05-16 12:46:31 +00:00
parent 8d874944b5
commit 9c285b426f
+4 -1
View File
@@ -12494,7 +12494,10 @@ function _initBrowserTtsVoices(selectedVoice) {
sel.innerHTML = '<option value="">— Caricamento voci… —</option>';
const populate = () => {
const voices = (window.speechSynthesis.getVoices() || []).filter(v => v != null && v.lang);
let voices = [];
try {
voices = (window.speechSynthesis.getVoices() || []).filter(v => v != null && v.lang);
} catch (_) { return false; }
if (!voices.length) return false;
// Italian voices first, then others
const it = voices.filter(v => v.lang.startsWith('it'));