diff --git a/src/options/component/WholeSettings.tsx b/src/options/component/WholeSettings.tsx index a04186d5..1a1fbae3 100644 --- a/src/options/component/WholeSettings.tsx +++ b/src/options/component/WholeSettings.tsx @@ -63,6 +63,9 @@ export const WholeSettings: React.FC = (props) => { return immer(orgSettings, (d) => { const errors = []; for (const key of Object.keys(d)) { + if (!(key in newSettings)) { + continue; + } if (!canReplace(d[key], newSettings[key])) { errors.push(`Invalid ${key}`); } diff --git a/src/options/logic/data.ts b/src/options/logic/data.ts index 58eb5a46..710b071d 100644 --- a/src/options/logic/data.ts +++ b/src/options/logic/data.ts @@ -53,7 +53,7 @@ const isShiftJisSoleChar = (byte: number) => { export const preProcessSettings = (settings: MouseDictionarySettings): MouseDictionarySettings => { return immer(settings, (d) => { - for (let i = 0; i < d.replaceRules.length; i++) { + for (let i = 0; i < d?.replaceRules?.length; i++) { d.replaceRules[i].key = i.toString(); } });