Code

player_command: break from switch if not playing
authorMax Kellermann <max@duempel.org>
Mon, 2 Nov 2009 17:53:07 +0000 (18:53 +0100)
committerMax Kellermann <max@duempel.org>
Mon, 2 Nov 2009 17:53:07 +0000 (18:53 +0100)
Eliminate one indent level.

src/player_command.c

index 54664e58e9bdb8c6a5ccc78a7ec0f4f0a505d5ff..226d18ca91d4b78092e88e18cc50bba9bdb350a6 100644 (file)
@@ -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)