Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldb09 committed Mar 5, 2023
1 parent 20c668d commit d93993a
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ class AudioLoaderRestHandler(
HttpStatus.BAD_REQUEST,
"No track to decode provided"
)
val decodedTrack = decodeTrack(audioPlayerManager, trackToDecode)
if(decodedTrack == null) return
val rightOne = decodedTrack.toTrack(trackToDecode)
return ResponseEntity.ok(DecodedTrack(rightOne.encoded, rightOne.info, rightOne.info))
val decodedTrack = decodeTrack(audioPlayerManager, trackToDecode).toTrack(trackToDecode) ?: throw ResponseStatusException(
HttpStatus.BAD_REQUEST,
"No track to decode provided"
)
return ResponseEntity.ok(DecodedTrack(decodedTrack.encoded, decodedTrack.info, decodedTrack.info))
}

@PostMapping(value = ["/decodetracks", "/v3/decodetracks"])
Expand All @@ -88,9 +89,10 @@ class AudioLoaderRestHandler(
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "No tracks to decode provided")
}
return ResponseEntity.ok(encodedTracks.map {
val trackE = decodeTrack(audioPlayerManager, it)
if(trackE == null) return
val track = trackE.toTrack(it)
val track = decodeTrack(audioPlayerManager, it).toTrack(it) ?: throw ResponseStatusException(
HttpStatus.BAD_REQUEST,
"No track to decode provided"
)
})
}

Expand Down

0 comments on commit d93993a

Please sign in to comment.