From d14a5d89609fbbbdf1dec6248f8afa9470824996 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 2 Nov 2009 18:53:07 +0100 Subject: [PATCH] player_command: break from switch if not playing Eliminate one indent level. --- src/player_command.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/player_command.c b/src/player_command.c index 54664e5..226d18c 100644 --- a/src/player_command.c +++ b/src/player_command.c @@ -121,17 +121,21 @@ handle_player_command(struct mpdclient *c, command_t cmd) break; case CMD_SEEK_FORWARD: song = mpdclient_get_current_song(c); - if (song != NULL) { - if (seek_id != (int)mpd_song_get_id(song)) { - seek_id = mpd_song_get_id(song); - seek_target_time = mpd_status_get_elapsed_time(c->status); - } - seek_target_time+=options.seek_time; - if (seek_target_time > (int)mpd_status_get_total_time(c->status)) - seek_target_time = mpd_status_get_total_time(c->status); - schedule_seek_timer(c); + if (song == NULL) + break; + + if (seek_id != (int)mpd_song_get_id(song)) { + seek_id = mpd_song_get_id(song); + seek_target_time = mpd_status_get_elapsed_time(c->status); } + + seek_target_time += options.seek_time; + if (seek_target_time > (int)mpd_status_get_total_time(c->status)) + seek_target_time = mpd_status_get_total_time(c->status); + + schedule_seek_timer(c); break; + case CMD_TRACK_NEXT: connection = mpdclient_get_connection(c); if (connection == NULL) @@ -142,17 +146,21 @@ handle_player_command(struct mpdclient *c, command_t cmd) break; case CMD_SEEK_BACKWARD: song = mpdclient_get_current_song(c); - if (song != NULL) { - if (seek_id != (int)mpd_song_get_id(song)) { - seek_id = mpd_song_get_id(c->song); - seek_target_time = mpd_status_get_elapsed_time(c->status); - } - seek_target_time-=options.seek_time; - if (seek_target_time < 0) - seek_target_time=0; - schedule_seek_timer(c); + if (song == NULL) + break; + + if (seek_id != (int)mpd_song_get_id(song)) { + seek_id = mpd_song_get_id(c->song); + seek_target_time = mpd_status_get_elapsed_time(c->status); } + + seek_target_time -= options.seek_time; + if (seek_target_time < 0) + seek_target_time = 0; + + schedule_seek_timer(c); break; + case CMD_TRACK_PREVIOUS: connection = mpdclient_get_connection(c); if (connection == NULL) -- 2.30.2