diff --git a/src/app/services/playlists.service.ts b/src/app/services/playlists.service.ts index 7c2d687c4..227c641e6 100644 --- a/src/app/services/playlists.service.ts +++ b/src/app/services/playlists.service.ts @@ -143,20 +143,34 @@ export class PlaylistsService { getPortalFavorites(portalId: string) { return this.dbService - .getByID<{ favorites: Partial[] }>( - DbStores.Playlists, - portalId - ) - .pipe(map((item) => item.favorites.filter(itm => itm && itm.stream_type && itm.stream_type !== 'live') ?? [])); + .getByID<{ + favorites: Partial[]; + }>(DbStores.Playlists, portalId) + .pipe( + map((item) => { + if (!item || !item.favorites) return []; + return item.favorites.filter( + (itm) => + itm && itm.stream_type && itm.stream_type !== 'live' + ); + }) + ); } getPortalLiveStreamFavorites(portalId: string) { return this.dbService - .getByID<{ favorites: Partial[] }>( - DbStores.Playlists, - portalId - ) - .pipe(map((item) => item.favorites.filter(itm => itm && itm.stream_type && itm.stream_type === 'live') ?? [])); + .getByID<{ + favorites: Partial[]; + }>(DbStores.Playlists, portalId) + .pipe( + map((item) => { + if (!item || !item.favorites) return []; + return item.favorites.filter( + (itm) => + itm && itm.stream_type && itm.stream_type === 'live' + ); + }) + ); } addPortalFavorite(portalId: string, item: any) { @@ -217,6 +231,7 @@ export class PlaylistsService { ) { try { const parsedPlaylist = parse(playlist); + console.log(parsedPlaylist); return createPlaylistObject( title, parsedPlaylist,