Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
Funkwhale Android
Commits
c29e36c6
Commit
c29e36c6
authored
Feb 25, 2022
by
Mouath Ibrahim
Committed by
Ryan Harg
Feb 25, 2022
Browse files
Bugfix/113 fix invalid null handling playlist
parent
41519bda
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/audio/funkwhale/ffa/repositories/PlaylistsRepository.kt
View file @
c29e36c6
...
@@ -108,7 +108,7 @@ class ManagementPlaylistsRepository(override val context: Context?) :
...
@@ -108,7 +108,7 @@ class ManagementPlaylistsRepository(override val context: Context?) :
}
}
suspend
fun
remove
(
albumId
:
Int
,
index
:
Int
)
{
suspend
fun
remove
(
albumId
:
Int
,
index
:
Int
)
{
context
?.
let
{
if
(
context
!=
null
)
{
val
body
=
mapOf
(
"index"
to
index
)
val
body
=
mapOf
(
"index"
to
index
)
val
request
=
Fuel
.
post
(
mustNormalizeUrl
(
"/api/v1/playlists/$albumId/remove/"
)).
apply
{
val
request
=
Fuel
.
post
(
mustNormalizeUrl
(
"/api/v1/playlists/$albumId/remove/"
)).
apply
{
...
@@ -122,12 +122,13 @@ class ManagementPlaylistsRepository(override val context: Context?) :
...
@@ -122,12 +122,13 @@ class ManagementPlaylistsRepository(override val context: Context?) :
.
header
(
"Content-Type"
,
"application/json"
)
.
header
(
"Content-Type"
,
"application/json"
)
.
body
(
Gson
().
toJson
(
body
))
.
body
(
Gson
().
toJson
(
body
))
.
awaitByteArrayResponseResult
()
.
awaitByteArrayResponseResult
()
}
}
else
{
throw
IllegalStateException
(
"Illegal state: context is null"
)
throw
IllegalStateException
(
"Illegal state: context is null"
)
}
}
}
fun
move
(
id
:
Int
,
from
:
Int
,
to
:
Int
)
{
fun
move
(
id
:
Int
,
from
:
Int
,
to
:
Int
)
{
context
?.
let
{
if
(
context
!=
null
)
{
val
body
=
mapOf
(
"from"
to
from
,
"to"
to
to
)
val
body
=
mapOf
(
"from"
to
from
,
"to"
to
to
)
val
request
=
Fuel
.
post
(
mustNormalizeUrl
(
"/api/v1/playlists/$id/move/"
)).
apply
{
val
request
=
Fuel
.
post
(
mustNormalizeUrl
(
"/api/v1/playlists/$id/move/"
)).
apply
{
...
@@ -143,7 +144,8 @@ class ManagementPlaylistsRepository(override val context: Context?) :
...
@@ -143,7 +144,8 @@ class ManagementPlaylistsRepository(override val context: Context?) :
.
body
(
Gson
().
toJson
(
body
))
.
body
(
Gson
().
toJson
(
body
))
.
awaitByteArrayResponseResult
()
.
awaitByteArrayResponseResult
()
}
}
}
else
{
throw
IllegalStateException
(
"Illegal state: context is null"
)
}
}
throw
IllegalStateException
(
"Illegal state: context is null"
)
}
}
}
}
changes/changelog.d/113.bugfix
0 → 100644
View file @
c29e36c6
Fix App crashes when interacting with playlist
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment