From: Max Kellermann Date: Mon, 20 Mar 2017 21:00:20 +0000 (+0100) Subject: save_playlist: move NULL check up X-Git-Tag: v0.27~16 X-Git-Url: https://git.tokkee.org/?p=ncmpc.git;a=commitdiff_plain;h=325049bb26fa97627800a3423a8462ab6ab8bfe9 save_playlist: move NULL check up --- diff --git a/src/save_playlist.c b/src/save_playlist.c index b7b7634..118d11a 100644 --- a/src/save_playlist.c +++ b/src/save_playlist.c @@ -109,6 +109,8 @@ playlist_save(struct mpdclient *c, char *name, char *defaultname) defaultname, NULL, gcmp); + if (filename == NULL) + return -1; /* destroy completion support */ wrln_completion_callback_data = NULL; @@ -116,15 +118,11 @@ playlist_save(struct mpdclient *c, char *name, char *defaultname) wrln_post_completion_callback = NULL; g_completion_free(gcmp); list = string_list_free(list); - if( filename ) - filename=g_strstrip(filename); + filename = g_strstrip(filename); } else #endif filename=g_strdup(name); - if (filename == NULL) - return -1; - /* send save command to mpd */ connection = mpdclient_get_connection(c);