Skip to content

Commit

Permalink
fix(database): not save empty list
Browse files Browse the repository at this point in the history
Signed-off-by: HystericalDragon <HystericalDragons@proton.me>
  • Loading branch information
xchacha20-poly1305 committed Mar 15, 2024
1 parent 6e2b328 commit a41070b
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ class ListConverter {
@TypeConverter
@JvmStatic
fun fromList(list: List<String>): String {
return list.joinToString(",")
return if (list.isEmpty()) {
""
} else {
list.joinToString(",")
}
}

@TypeConverter
@JvmStatic
fun toList(string: String): List<String> {
return string.split(",")
fun toList(str: String): List<String> {
return if (str.isBlank()) {
listOf()
} else {
str.split(",")
}
}
}
}
Expand Down

0 comments on commit a41070b

Please sign in to comment.