Skip to content

Commit

Permalink
playlist order edge case fix
Browse files Browse the repository at this point in the history
  • Loading branch information
David Schmidt committed Jan 21, 2012
1 parent 6433e21 commit 5e135e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Soundgarden/Controller/Playlist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ sub move_song_to_pos : Method('POST') Chained('base_with_id') PathPart('move_son
my $playlist = $c->stash->{playlist};
my $count = $playlist->playlist_songs->count;

if ( $pos <= 0 || $pos > $count) {
$pos = $count if $pos > $count;
if ( $pos <= 0 ) {
$c->res->body('Invalid position in playlist.');
$c->res->status(400);
$c->detach;
Expand Down

0 comments on commit 5e135e1

Please sign in to comment.