From 325049bb26fa97627800a3423a8462ab6ab8bfe9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Mar 2017 22:00:20 +0100 Subject: [PATCH] save_playlist: move NULL check up --- src/save_playlist.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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); -- 2.30.2