From 6358124ce8340fe6d68bf458361f82cfdbbc6584 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 23 Mar 2016 09:58:17 -0400 Subject: [PATCH] gui: Check the return code from collection_check_library() If the library isn't valid, then we shouldn't try to pick another track until the user fixes things. Signed-off-by: Anna Schumaker --- gui/gst.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gui/gst.cpp b/gui/gst.cpp index 10ddf959..f3307b9f 100644 --- a/gui/gst.cpp +++ b/gui/gst.cpp @@ -144,29 +144,33 @@ public: static GSTDriver *gst_driver; -static void parse_gst_error(GstMessage *error) +static int parse_gst_error(GstMessage *error) { GError *err; struct track *track = audio :: current_track(); gchar *path; + int ret = 0; gst_message_parse_error(error, &err, NULL); if (track) { path = track_path(track); g_print("Error playing file: %s\n", path); - collection_check_library(track->tr_library); + ret = collection_check_library(track->tr_library); g_free(path); } g_print("Error: %s\n", err->message); g_error_free(err); + + return ret; } static gboolean on_gst_message(GstBus *bus, GstMessage *message, gpointer data) { switch (GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_ERROR: - parse_gst_error(message); + if (parse_gst_error(message) < 0) + break; audio :: next(); audio :: play(); break;