aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-06-25 22:01:18 +0200
committerMax Kellermann <max@duempel.org>2010-06-25 22:37:34 +0200
commitfba13bd5d218f0fd73d2f4017302aef9d075b35c (patch)
treebb4534128bd6671bc8c1c996141d96e717184e53
parent68f75955d8ac31cab5c0e687ac4d7157926b0360 (diff)
downloadmpd-fba13bd5d218f0fd73d2f4017302aef9d075b35c.tar.gz
mpd-fba13bd5d218f0fd73d2f4017302aef9d075b35c.tar.xz
mpd-fba13bd5d218f0fd73d2f4017302aef9d075b35c.zip
playlist_queue: simplify error handler
Return early on error, save one level of indent.
-rw-r--r--src/playlist_queue.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/playlist_queue.c b/src/playlist_queue.c
index 9241d4774..dd5d0dd4a 100644
--- a/src/playlist_queue.c
+++ b/src/playlist_queue.c
@@ -103,16 +103,15 @@ playlist_open_into_queue(const char *uri, struct playlist *dest)
struct input_stream *is;
struct playlist_provider *playlist = playlist_mapper_open(uri, &is);
- if (playlist != NULL) {
- enum playlist_result result =
- playlist_load_into_queue(uri, playlist, dest);
- playlist_plugin_close(playlist);
+ if (playlist == NULL)
+ return PLAYLIST_RESULT_NO_SUCH_LIST;
- if (is != NULL)
- input_stream_close(is);
+ enum playlist_result result =
+ playlist_load_into_queue(uri, playlist, dest);
+ playlist_plugin_close(playlist);
- return result;
- }
+ if (is != NULL)
+ input_stream_close(is);
- return PLAYLIST_RESULT_NO_SUCH_LIST;
+ return result;
}