Skip to content
Snippets Groups Projects
Commit c29e36c6 authored by Mouath Ibrahim's avatar Mouath Ibrahim Committed by Ryan Harg
Browse files

Bugfix/113 fix invalid null handling playlist

parent 41519bda
No related branches found
No related tags found
1 merge request!143Bugfix/113 fix invalid null handling playlist
......@@ -108,7 +108,7 @@ class ManagementPlaylistsRepository(override val context: Context?) :
}
suspend fun remove(albumId: Int, index: Int) {
context?.let {
if (context != null) {
val body = mapOf("index" to index)
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/$albumId/remove/")).apply {
......@@ -122,12 +122,13 @@ class ManagementPlaylistsRepository(override val context: Context?) :
.header("Content-Type", "application/json")
.body(Gson().toJson(body))
.awaitByteArrayResponseResult()
}
} else {
throw IllegalStateException("Illegal state: context is null")
}
}
fun move(id: Int, from: Int, to: Int) {
context?.let {
if (context != null) {
val body = mapOf("from" to from, "to" to to)
val request = Fuel.post(mustNormalizeUrl("/api/v1/playlists/$id/move/")).apply {
......@@ -143,7 +144,8 @@ class ManagementPlaylistsRepository(override val context: Context?) :
.body(Gson().toJson(body))
.awaitByteArrayResponseResult()
}
}
} else {
throw IllegalStateException("Illegal state: context is null")
}
}
}
Fix App crashes when interacting with playlist
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment