Skip to content

Commit

Permalink
fix: android auto crash when streamUrl comes as null
Browse files Browse the repository at this point in the history
  • Loading branch information
KestasVenslauskas committed Jan 3, 2025
1 parent c8acbb8 commit 125ca0a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LRTAutoRepository(private val api: LRTAutoService) {
suspend fun getRecommended() = withContext(Dispatchers.IO) {
if (System.currentTimeMillis() - recommendedLastFetchTime > CACHE_DURATION || recommended.isEmpty()) {
try{
recommended = api.getRecommendedPlaylist()
recommended = api.getRecommendedPlaylist().filter { it.streamUrl != null }
if (recommended.isNotEmpty()) {
recommendedLastFetchTime = System.currentTimeMillis()
}
Expand All @@ -34,7 +34,7 @@ class LRTAutoRepository(private val api: LRTAutoService) {
suspend fun getNewest() = withContext(Dispatchers.IO) {
if (System.currentTimeMillis() - newestLastFetchTime > CACHE_DURATION || newest.isEmpty()) {
try{
newest = api.getNewestPlaylist()
newest = api.getNewestPlaylist().filter { it.streamUrl != null }
if (newest.isNotEmpty()){
newestLastFetchTime = System.currentTimeMillis()
}
Expand Down

0 comments on commit 125ca0a

Please sign in to comment.