Guard against crash if episode has seasonId but no seriesId (#1964)
## Description When clicking on an episode, the app assumes if there is a season ID for the episode, then there must be a series ID. However, on my JF 12.0 server, an episode (with no metadata) appeared on my Continue Watching and it has a season ID (which in turn has a series ID) but no series ID. I'm not sure if this really a valid situation or if it's a server bug, but Wholphin shouldn't crash at least. So this PR checks both `seasonId` and `seriesId` and if either is null, falls back to the generic "Episode Page". Similarly, if a season has no `seriesId` (again, not sure if a valid situation), a crash won't occur, however there is no generic "Season Page", so an error page is shown. ### Related issues TODO, check JF server issues, maybe fixed in 12.1? ### Testing Emulator ## Screenshots N/a ## AI or LLM usage None
This commit is contained in:
parent
32a56e8387
commit
170989c31e
1 changed files with 17 additions and 8 deletions
|
|
@ -237,21 +237,30 @@ data class BaseItem(
|
|||
// Redirect episodes & seasons to their series if possible
|
||||
when (type) {
|
||||
BaseItemKind.EPISODE -> {
|
||||
data.seasonId?.let { seasonId ->
|
||||
val seasonId = data.seasonId
|
||||
val seriesId = data.seriesId
|
||||
if (seasonId != null && seriesId != null) {
|
||||
Destination.SeriesOverview(
|
||||
data.seriesId!!,
|
||||
seriesId,
|
||||
BaseItemKind.SERIES,
|
||||
SeasonEpisodeIds(seasonId, data.parentIndexNumber, id, indexNumber),
|
||||
)
|
||||
} ?: Destination.MediaItem(this)
|
||||
} else {
|
||||
Destination.MediaItem(this)
|
||||
}
|
||||
}
|
||||
|
||||
BaseItemKind.SEASON -> {
|
||||
Destination.SeriesOverview(
|
||||
data.seriesId!!,
|
||||
BaseItemKind.SERIES,
|
||||
SeasonEpisodeIds(id, indexNumber, null, null),
|
||||
)
|
||||
val seriesId = data.seriesId
|
||||
if (seriesId != null) {
|
||||
Destination.SeriesOverview(
|
||||
seriesId,
|
||||
BaseItemKind.SERIES,
|
||||
SeasonEpisodeIds(id, indexNumber, null, null),
|
||||
)
|
||||
} else {
|
||||
Destination.MediaItem(this)
|
||||
}
|
||||
}
|
||||
|
||||
BaseItemKind.TV_CHANNEL -> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue