Skip to content

Commit a637e04

Browse files
fix: trending crash
1 parent d191145 commit a637e04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/src/commonMain/kotlin/project/pipepipe/app/viewmodel/PlaylistDetailViewModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ class PlaylistDetailViewModel : BaseViewModel<PlaylistUiState>(PlaylistUiState()
119119

120120
// Check if this remote playlist is bookmarked in database
121121
val playlistInfo = result.info as? PlaylistInfo
122-
val bookmarkedPlaylist = DatabaseOperations.getRemotePlaylistByUrl(playlistInfo!!.url)
122+
val bookmarkedPlaylist = if (playlistInfo?.serviceId != null) {
123+
DatabaseOperations.getRemotePlaylistByUrl(playlistInfo.url)
124+
} else null
123125

124126
val finalPlaylistInfo = if (bookmarkedPlaylist != null) {
125-
playlistInfo.copy(
127+
playlistInfo?.copy(
126128
uid = bookmarkedPlaylist.uid,
127129
isPinned = bookmarkedPlaylist.is_pinned != 0L
128130
)

0 commit comments

Comments
 (0)