diff options
author | Max Kellermann <max@duempel.org> | 2010-05-30 23:38:56 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-05-30 23:45:46 +0200 |
commit | 980201a6655fc9d3f7b22eb00ed5a96c360b707b (patch) | |
tree | 069a7ff4aa057fc6b78e287d6ffd0fe33242d602 | |
parent | d60bcd2869370225dee53af2c58c84c846958215 (diff) | |
download | mpd-980201a6655fc9d3f7b22eb00ed5a96c360b707b.tar.gz mpd-980201a6655fc9d3f7b22eb00ed5a96c360b707b.tar.xz mpd-980201a6655fc9d3f7b22eb00ed5a96c360b707b.zip |
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.
-rw-r--r-- | src/inotify_update.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); |