mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +00:00
fix(store): fix TypeError: Cannot convert undefined or null to object
This commit is contained in:
@ -85,28 +85,29 @@ const migrations = {
|
|||||||
shortcut: unknown;
|
shortcut: unknown;
|
||||||
}[]
|
}[]
|
||||||
| Record<string, unknown>
|
| Record<string, unknown>
|
||||||
>;
|
> | undefined;
|
||||||
let updated = false;
|
if (options) {
|
||||||
for (const optionType of ['global', 'local']) {
|
let updated = false;
|
||||||
if (Object.hasOwn(options, optionType) && Array.isArray(options[optionType])) {
|
for (const optionType of ['global', 'local']) {
|
||||||
const optionsArray = options[optionType] as {
|
if (Object.hasOwn(options, optionType) && Array.isArray(options[optionType])) {
|
||||||
action: string;
|
const optionsArray = options[optionType] as {
|
||||||
shortcut: unknown;
|
action: string;
|
||||||
}[];
|
shortcut: unknown;
|
||||||
const updatedOptions: Record<string, unknown> = {};
|
}[];
|
||||||
for (const optionObject of optionsArray) {
|
const updatedOptions: Record<string, unknown> = {};
|
||||||
if (optionObject.action && optionObject.shortcut) {
|
for (const optionObject of optionsArray) {
|
||||||
updatedOptions[optionObject.action] = optionObject.shortcut;
|
if (optionObject.action && optionObject.shortcut) {
|
||||||
|
updatedOptions[optionObject.action] = optionObject.shortcut;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options[optionType] = updatedOptions;
|
||||||
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
options[optionType] = updatedOptions;
|
|
||||||
updated = true;
|
|
||||||
}
|
}
|
||||||
}
|
if (updated) {
|
||||||
|
store.set('plugins.shortcuts', options);
|
||||||
if (updated) {
|
}
|
||||||
store.set('plugins.shortcuts', options);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'>=1.11.0'(store: Conf<Record<string, unknown>>) {
|
'>=1.11.0'(store: Conf<Record<string, unknown>>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user