fix(store): fix TypeError: Cannot convert undefined or null to object

This commit is contained in:
JellyBrick
2023-11-28 05:51:47 +09:00
parent ac0b78eefb
commit 09450fb8c7

View File

@ -85,7 +85,8 @@ const migrations = {
shortcut: unknown; shortcut: unknown;
}[] }[]
| Record<string, unknown> | Record<string, unknown>
>; > | undefined;
if (options) {
let updated = false; let updated = false;
for (const optionType of ['global', 'local']) { for (const optionType of ['global', 'local']) {
if (Object.hasOwn(options, optionType) && Array.isArray(options[optionType])) { if (Object.hasOwn(options, optionType) && Array.isArray(options[optionType])) {
@ -104,10 +105,10 @@ const migrations = {
updated = true; updated = true;
} }
} }
if (updated) { if (updated) {
store.set('plugins.shortcuts', options); store.set('plugins.shortcuts', options);
} }
}
}, },
'>=1.11.0'(store: Conf<Record<string, unknown>>) { '>=1.11.0'(store: Conf<Record<string, unknown>>) {
if (store.get('options.resumeOnStart') === undefined) { if (store.get('options.resumeOnStart') === undefined) {