From 980201a6655fc9d3f7b22eb00ed5a96c360b707b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 30 May 2010 23:38:56 +0200 Subject: inotify_update: fix assertion failure when music dir is deleted This shouldn't really happen, but insane users might delete/rename the music directory while MPD runs. What was even more insane was that MPD crashed due to this. This is a workaround - there is currently nothing useful we can do in this case; except maybe poll for the music directory to reappear, but that's too much trouble for a user error. --- src/inotify_update.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/inotify_update.c b/src/inotify_update.c index 218440110..4939aa557 100644 --- a/src/inotify_update.c +++ b/src/inotify_update.c @@ -97,7 +97,13 @@ static void remove_watch_directory(struct watch_directory *directory) { assert(directory != NULL); - assert(directory->parent != NULL); + + if (directory->parent == NULL) { + g_warning("music directory was removed - " + "cannot continue to watch it"); + return; + } + assert(directory->parent->children != NULL); tree_remove_watch_directory(directory); -- cgit v1.2.3