Fix: settings.appearance may be undefined

This commit is contained in:
Vendicated 2022-10-31 17:17:54 +01:00
parent 8adf7ca155
commit 0fda900ccc
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3

View file

@ -33,10 +33,12 @@ export async function launchMonacoEditor() {
win.setCss = setCss; win.setCss = setCss;
win.getCurrentCss = () => VencordNative.ipc.invoke(IpcEvents.GET_QUICK_CSS); win.getCurrentCss = () => VencordNative.ipc.invoke(IpcEvents.GET_QUICK_CSS);
win.getTheme = () => find(m => m.ProtoClass?.typeName.endsWith("PreloadedUserSettings")) win.getTheme = () =>
.getCurrentValue().appearance.theme === 1 find(m =>
? "vs-dark" m.ProtoClass?.typeName.endsWith("PreloadedUserSettings")
: "vs-light"; )?.getCurrentValue()?.appearance?.theme === 2
? "vs-light"
: "vs-dark";
win.document.write(monacoHtml); win.document.write(monacoHtml);
} }