BetterSettings: fix error handling crashing in some niche cases

This commit is contained in:
Vendicated 2024-05-09 03:04:03 +02:00
parent 840a8f1fdd
commit a2acce55c3
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -131,16 +131,11 @@ export default definePlugin({
// try catch will only catch errors in the Layer function (hence why it's called as a plain function rather than a component), but // try catch will only catch errors in the Layer function (hence why it's called as a plain function rather than a component), but
// not in children // not in children
Layer(props: LayerProps) { Layer(props: LayerProps) {
try { if (!FocusLock || !ComponentDispatch) {
if (!FocusLock || !ComponentDispatch) new Logger("BetterSettings").error("Failed to find some components");
throw new Error("Failed to fetch some webpack modules");
return Layer(props);
} catch (e) {
new Logger("BetterSettings").error("Failed to render Layer", e);
} }
return props.children; return <Layer {...props} />;
}, },
wrapMenu(list: SettingsEntry[]) { wrapMenu(list: SettingsEntry[]) {