From 4b2bf282a1433ad220f66601c6ae78f53b8953d3 Mon Sep 17 00:00:00 2001 From: hola Date: Sat, 8 Aug 2026 16:48:19 +0300 Subject: [PATCH 1/3] Update audio.ts --- audio.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/audio.ts b/audio.ts index cb4425c..aa64b6e 100644 --- a/audio.ts +++ b/audio.ts @@ -195,7 +195,12 @@ function dataUriToArrayBuffer(dataUri: string): ArrayBuffer | null { } export async function getAllAudio(): Promise> { - return (await get(KEY)) ?? {}; + try { + return (await get(KEY)) ?? {}; + } catch (e) { + console.error("[CustomSounds] Failed to read audio store:", e); + return {}; + } } export async function getAudioMeta(): Promise> { From 5c4276361dcda8f9cbb4f03325b51133653a6a59 Mon Sep 17 00:00:00 2001 From: hola Date: Sat, 8 Aug 2026 16:49:20 +0300 Subject: [PATCH 2/3] Update index.tsx --- index.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/index.tsx b/index.tsx index d1788e0..e9cf804 100644 --- a/index.tsx +++ b/index.tsx @@ -120,7 +120,21 @@ function SettingsUI() { const fileInputRef = React.useRef(null); const loadFiles = React.useCallback(async () => { - try { setFiles(await getAudioMeta()); } catch (e) { console.error("[CustomSounds]", e); } + try { + const meta = await getAudioMeta(); + setFiles(meta); + let healed = false; + for (const t of soundTypes) { + const o = getOverride(t.id); + if (o.selectedSound === "custom" && o.selectedFileId && !meta[o.selectedFileId]) { + o.selectedFileId = undefined; + o.selectedSound = "default"; + setOverride(t.id, o); + healed = true; + } + } + if (healed) setResetTrigger(t => t + 1); + } catch (e) { console.error("[CustomSounds]", e); } }, []); React.useEffect(() => { From d1c6fea653b4e79505e265f332daebba2808d6d8 Mon Sep 17 00:00:00 2001 From: hola Date: Sat, 8 Aug 2026 16:49:53 +0300 Subject: [PATCH 3/3] Update index.tsx --- index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.tsx b/index.tsx index e9cf804..41eee3c 100644 --- a/index.tsx +++ b/index.tsx @@ -138,7 +138,9 @@ function SettingsUI() { }, []); React.useEffect(() => { - soundTypes.forEach(t => { if (!settings.store[t.id]) setOverride(t.id, makeEmptyOverride()); }); + try { + soundTypes.forEach(t => { if (!settings.store[t.id]) setOverride(t.id, makeEmptyOverride()); }); + } catch (e) { console.error("[CustomSounds]", e); } loadFiles(); }, []);