From 0fda900ccc5c7c4560a911b028d53faece620bfc Mon Sep 17 00:00:00 2001 From: Vendicated Date: Mon, 31 Oct 2022 17:17:54 +0100 Subject: Fix: settings.appearance may be undefined --- src/components/Monaco.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Monaco.ts b/src/components/Monaco.ts index e147159..f40db77 100644 --- a/src/components/Monaco.ts +++ b/src/components/Monaco.ts @@ -33,10 +33,12 @@ export async function launchMonacoEditor() { win.setCss = setCss; win.getCurrentCss = () => VencordNative.ipc.invoke(IpcEvents.GET_QUICK_CSS); - win.getTheme = () => find(m => m.ProtoClass?.typeName.endsWith("PreloadedUserSettings")) - .getCurrentValue().appearance.theme === 1 - ? "vs-dark" - : "vs-light"; + win.getTheme = () => + find(m => + m.ProtoClass?.typeName.endsWith("PreloadedUserSettings") + )?.getCurrentValue()?.appearance?.theme === 2 + ? "vs-light" + : "vs-dark"; win.document.write(monacoHtml); } -- cgit