mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-11-06 10:50:58 +01:00
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
|
// Redirect episodes & seasons to their series if possible
|
||||||
when (type) {
|
when (type) {
|
||||||
BaseItemKind.EPISODE -> {
|
BaseItemKind.EPISODE -> {
|
||||||
data.seasonId?.let { seasonId ->
|
val seasonId = data.seasonId
|
||||||
|
val seriesId = data.seriesId
|
||||||
|
if (seasonId != null && seriesId != null) {
|
||||||
Destination.SeriesOverview(
|
Destination.SeriesOverview(
|
||||||
data.seriesId!!,
|
seriesId,
|
||||||
BaseItemKind.SERIES,
|
BaseItemKind.SERIES,
|
||||||
SeasonEpisodeIds(seasonId, data.parentIndexNumber, id, indexNumber),
|
SeasonEpisodeIds(seasonId, data.parentIndexNumber, id, indexNumber),
|
||||||
)
|
)
|
||||||
} ?: Destination.MediaItem(this)
|
} else {
|
||||||
|
Destination.MediaItem(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseItemKind.SEASON -> {
|
BaseItemKind.SEASON -> {
|
||||||
Destination.SeriesOverview(
|
val seriesId = data.seriesId
|
||||||
data.seriesId!!,
|
if (seriesId != null) {
|
||||||
BaseItemKind.SERIES,
|
Destination.SeriesOverview(
|
||||||
SeasonEpisodeIds(id, indexNumber, null, null),
|
seriesId,
|
||||||
)
|
BaseItemKind.SERIES,
|
||||||
|
SeasonEpisodeIds(id, indexNumber, null, null),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Destination.MediaItem(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseItemKind.TV_CHANNEL -> {
|
BaseItemKind.TV_CHANNEL -> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue