mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-07-06 12:32:53 +01:00
fix: handle null settings in useSkipOptions for safer access
This commit is contained in:
@@ -22,7 +22,7 @@ const useSkipOptions = (
|
|||||||
| "skipRecap"
|
| "skipRecap"
|
||||||
| "skipCommercial"
|
| "skipCommercial"
|
||||||
| "skipPreview",
|
| "skipPreview",
|
||||||
settings: ReturnType<typeof useSettings>["settings"],
|
settings: ReturnType<typeof useSettings>["settings"] | null,
|
||||||
updateSettings: ReturnType<typeof useSettings>["updateSettings"],
|
updateSettings: ReturnType<typeof useSettings>["updateSettings"],
|
||||||
t: TFunction<"translation", undefined>,
|
t: TFunction<"translation", undefined>,
|
||||||
) => {
|
) => {
|
||||||
@@ -33,12 +33,12 @@ const useSkipOptions = (
|
|||||||
type: "radio" as const,
|
type: "radio" as const,
|
||||||
label: option.label,
|
label: option.label,
|
||||||
value: option.value,
|
value: option.value,
|
||||||
selected: option.value === settings[settingKey],
|
selected: option.value === settings?.[settingKey],
|
||||||
onPress: () => updateSettings({ [settingKey]: option.value }),
|
onPress: () => updateSettings({ [settingKey]: option.value }),
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[settings[settingKey], updateSettings, t, settingKey],
|
[settings?.[settingKey], updateSettings, t, settingKey],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user