fix a crash when url or vcodes are missing for a stream
always initialize them, also initialize hardsub_locale since it might be optional too
This commit is contained in:
parent
4c55bb771f
commit
97966f5ad3
|
@ -331,7 +331,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(searchEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in search(), with query = \"$query\".", ex)
|
||||
NoneSearchResult
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(episodesEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in objects().", ex)
|
||||
NoneCollection
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(seasonListEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in seasonList().", ex)
|
||||
NoneDiscSeasonList
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(seriesEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in series().", ex)
|
||||
NoneSeries
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(upNextSeriesEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in upNextSeries().", ex)
|
||||
NoneUpNextSeriesItem
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(seasonsEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in seasons().", ex)
|
||||
NoneSeasons
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(episodesEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in episodes().", ex)
|
||||
NoneEpisodes
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ object Crunchyroll {
|
|||
suspend fun playback(url: String): Playback {
|
||||
return try {
|
||||
requestGet("", url = url)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in playback(), with url = $url.", ex)
|
||||
NonePlayback
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ object Crunchyroll {
|
|||
return try {
|
||||
(requestGet(watchlistSeriesEndpoint, parameters) as JsonObject)
|
||||
.containsKey(seriesId)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in isWatchlist() with seriesId = $seriesId", ex)
|
||||
false
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(similarToEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in similarTo().", ex)
|
||||
NoneSimilarToResult
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ object Crunchyroll {
|
|||
|
||||
val list: ContinueWatchingList = try {
|
||||
requestGet(watchlistEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in watchlist().", ex)
|
||||
NoneContinueWatchingList
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(watchlistEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in upNextAccount().", ex)
|
||||
NoneContinueWatchingList
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(recommendationsEndpoint, parameters)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in recommendations().", ex)
|
||||
NoneRecommendationsList
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ object Crunchyroll {
|
|||
|
||||
return try {
|
||||
requestGet(profileEndpoint)
|
||||
}catch (ex: SerializationException) {
|
||||
} catch (ex: SerializationException) {
|
||||
Log.e(TAG, "SerializationException in profile().", ex)
|
||||
NoneProfile
|
||||
}
|
||||
|
|
|
@ -380,9 +380,9 @@ data class Streams(
|
|||
|
||||
@Serializable
|
||||
data class Stream(
|
||||
@SerialName("hardsub_locale") val hardsubLocale: String,
|
||||
@SerialName("url") val url: String,
|
||||
@SerialName("vcodec") val vcodec: String,
|
||||
@SerialName("hardsub_locale") val hardsubLocale: String = "", // default/nullable value since might be optional
|
||||
@SerialName("url") val url: String = "", // default/nullable value since optional
|
||||
@SerialName("vcodec") val vcodec: String = "", // default/nullable value since optional
|
||||
)
|
||||
|
||||
val NonePlayback = Playback(
|
||||
|
|
Loading…
Reference in New Issue