mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-04-21 08:14:42 +01:00
fix(player): add null guards for item in play settings
This commit is contained in:
@@ -42,12 +42,17 @@ export interface PreviousIndexes {
|
||||
* @param previous - Optional previous track selections to carry over (for sequential play)
|
||||
*/
|
||||
export function getDefaultPlaySettings(
|
||||
item: BaseItemDto,
|
||||
item: BaseItemDto | null | undefined,
|
||||
settings: Settings | null,
|
||||
previous?: { indexes?: PreviousIndexes; source?: MediaSourceInfo },
|
||||
): PlaySettings {
|
||||
const bitrate = settings?.defaultBitrate ?? BITRATES[0];
|
||||
|
||||
// Handle undefined/null item
|
||||
if (!item) {
|
||||
return { item: {} as BaseItemDto, bitrate };
|
||||
}
|
||||
|
||||
// Live TV programs don't have media sources
|
||||
if (item.Type === "Program") {
|
||||
return { item, bitrate };
|
||||
|
||||
Reference in New Issue
Block a user