Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSON decode crash in PictureViewerFragment #3627

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.serialization.json.Json
import org.jellyfin.androidtv.R
import org.jellyfin.androidtv.databinding.FragmentPictureViewerBinding
import org.jellyfin.androidtv.ui.AsyncImageView
Expand Down Expand Up @@ -60,10 +59,10 @@ class PictureViewerFragment : Fragment(), View.OnKeyListener {
lifecycleScope.launch {
val itemId = requireNotNull(arguments?.getString(ARGUMENT_ITEM_ID)?.toUUIDOrNull())
val albumSortBy = arguments?.getString(ARGUMENT_ALBUM_SORT_BY)?.let {
Json.Default.decodeFromString<ItemSortBy>(it)
ItemSortBy.fromNameOrNull(it)
} ?: ItemSortBy.SORT_NAME
val albumSortOrder = arguments?.getString(ARGUMENT_ALBUM_SORT_ORDER)?.let {
Json.Default.decodeFromString<SortOrder>(it)
SortOrder.fromNameOrNull(it)
} ?: SortOrder.ASCENDING
pictureViewerViewModel.loadItem(itemId, setOf(albumSortBy), albumSortOrder)

Expand Down
Loading