diff --git a/source/Main.bs b/source/Main.bs index 3b3799e71..33c3ba856 100644 --- a/source/Main.bs +++ b/source/Main.bs @@ -307,7 +307,12 @@ sub Main (args as dynamic) as void else if selectedItemType = "Series" group = CreateSeriesDetailsGroup(selectedItem.json.id) else if selectedItemType = "Season" - group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id) + if isValid(selectedItem.json) and isValid(selectedItem.json.SeriesId) and isValid(selectedItem.id) + group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id) + else + stopLoadingSpinner() + message_dialog(tr("Error loading Season")) + end if else if selectedItemType = "Movie" ' open movie detail page group = CreateMovieDetailsGroup(selectedItem) @@ -810,7 +815,7 @@ sub Main (args as dynamic) as void selectedItem = m.global.queueManager.callFunc("getHold") m.global.queueManager.callFunc("clearHold") - if isValid(selectedItem) and selectedItem.count() > 0 and isValid(selectedItem[0]) + if isValidAndNotEmpty(selectedItem) and isValid(selectedItem[0]) if popupNode.returnData.indexselected = 0 'Resume video from resume point startLoadingSpinner() @@ -838,7 +843,13 @@ sub Main (args as dynamic) as void CreateSeriesDetailsGroup(selectedItem[0].json.SeriesId) else if popupNode.returnData.indexselected = 3 ' User chose Go to season - CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID) + if isValid(selectedItem[0].json) and isValid(selectedItem[0].json.SeriesId) and isValid(selectedItem[0].json.seasonID) + CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID) + else + stopLoadingSpinner() + message_dialog(tr("Error loading Season")) + end if + else if popupNode.returnData.indexselected = 4 ' User chose Go to episode CreateMovieDetailsGroup(selectedItem[0]) diff --git a/source/ShowScenes.bs b/source/ShowScenes.bs index a02fab025..4aa14f8e6 100644 --- a/source/ShowScenes.bs +++ b/source/ShowScenes.bs @@ -644,7 +644,7 @@ function CreateSeriesDetailsGroup(seriesID as string) as dynamic ' Get season data early in the function so we can check number of seasons. seasonData = TVSeasons(seriesID) ' Divert to season details if user setting goStraightToEpisodeListing is enabled and only one season exists. - if m.global.session.user.settings["ui.tvshows.goStraightToEpisodeListing"] = true and seasonData.Items.Count() = 1 + if seasonData <> invalid and m.global.session.user.settings["ui.tvshows.goStraightToEpisodeListing"] and seasonData.Items.Count() = 1 stopLoadingSpinner() return CreateSeasonDetailsGroupByID(seriesID, seasonData.Items[0].id) end if