Skip to content

Commit

Permalink
fix websocket crash when seeking and nothing is playing
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Oct 13, 2023
1 parent cb866b3 commit 982062b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class WebSocketHandler(

private fun seek(json: JSONObject) {
val player = context.getPlayer(json.getLong("guildId"))
if (!player.isPlaying) {
log.warn("Can't seek when player is not playing anything")
return
}
player.seekTo(json.getLong("position"))
SocketServer.sendPlayerUpdate(context, player)
}
Expand Down

0 comments on commit 982062b

Please sign in to comment.