From 03249ff5f4c0f5517b3b9a73fd8d4bbcda5487cf Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sun, 4 Nov 2018 09:28:41 +0000 Subject: [PATCH] Fix: Do not segfault if no real source could be found --- src/stats.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/stats.c b/src/stats.c index 9a9c7295..c40883c0 100644 --- a/src/stats.c +++ b/src/stats.c @@ -893,13 +893,16 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i avl_tree_rlock(global.source_tree); source_real = source_find_mount_raw(source->source); - history = playlist_render_xspf(source_real->history); - if (history) - xmlAddChild(xmlnode, history); - metadata = xmlNewTextChild(xmlnode, NULL, XMLSTR("metadata"), NULL); - if (source_real->format) { - for (i = 0; i < source_real->format->vc.comments; i++) - __add_metadata(metadata, source_real->format->vc.user_comments[i]); + if (source_real) { + history = playlist_render_xspf(source_real->history); + if (history) + xmlAddChild(xmlnode, history); + + metadata = xmlNewTextChild(xmlnode, NULL, XMLSTR("metadata"), NULL); + if (source_real->format) { + for (i = 0; i < source_real->format->vc.comments; i++) + __add_metadata(metadata, source_real->format->vc.user_comments[i]); + } } avl_tree_unlock(global.source_tree);