Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on episode list #1889

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions source/Main.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion source/ShowScenes.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading