diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/models/Info.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/models/Info.kt index 52ae2a6..161a3ca 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/models/Info.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/models/Info.kt @@ -2,5 +2,5 @@ package it.vfsfitvnm.vimusic.models data class Info( val id: String, - val name: String + val name: String? ) diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/savers/InfoSaver.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/savers/InfoSaver.kt index d8422ea..12bd22d 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/savers/InfoSaver.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/savers/InfoSaver.kt @@ -4,12 +4,10 @@ import androidx.compose.runtime.saveable.Saver import androidx.compose.runtime.saveable.SaverScope import it.vfsfitvnm.vimusic.models.Info -object InfoSaver : Saver> { - override fun SaverScope.save(value: Info): List = listOf(value.id, value.name) +object InfoSaver : Saver> { + override fun SaverScope.save(value: Info) = listOf(value.id, value.name) - override fun restore(value: List): Info? { - return if (value.size == 2) Info(id = value[0], name = value[1]) else null - } + override fun restore(value: List) = Info(id = value[0] as String, name = value[1]) } val InfoListSaver = listSaver(InfoSaver)