From 1c151745e2ad88eddd503be2c4850e515363d780 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Wed, 29 May 2024 10:19:52 +0800 Subject: [PATCH] fix: crash when opening noti settings --- src/lib/ui/settings/patches/panel.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/ui/settings/patches/panel.tsx b/src/lib/ui/settings/patches/panel.tsx index 6c5d88e..19aab0b 100644 --- a/src/lib/ui/settings/patches/panel.tsx +++ b/src/lib/ui/settings/patches/panel.tsx @@ -50,10 +50,12 @@ export function patchPanelUI(unpatches: (() => void | boolean)[]) { const sections = findInReactTree( res.props.children, n => n?.children?.[1]?.type === LegacyFormSection - ).children; + )?.children; - const index = sections.findIndex((c: any) => titles.includes(c?.props.label)); - sections.splice(-~index || 4, 0, ); + if (sections) { + const index = sections.findIndex((c: any) => titles.includes(c?.props.label)); + sections.splice(-~index || 4, 0, ); + } })); }, true);