diff options
author | Max Kellermann <max@musicpd.org> | 2019-10-07 12:23:58 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-10-07 12:24:25 +0200 |
commit | 23d08820a2bec1182c838de34cc2c6687dc95558 (patch) | |
tree | 5ef6e75e7c5f953656ef1a08b03caf60e31e6918 /src | |
parent | b9b906ab208cf0243b3be3f61af279cd4c9d0483 (diff) |
db/update/Walk: fix crash when music_directory is not a directory
Add a runtime sanity check to avoid the assertion failure.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/660
Diffstat (limited to 'src')
-rw-r--r-- | src/db/update/Walk.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx index c13d6fd40..e2c9b7a8c 100644 --- a/src/db/update/Walk.cxx +++ b/src/db/update/Walk.cxx @@ -493,6 +493,12 @@ UpdateWalk::Walk(Directory &root, const char *path, bool discard) noexcept if (!GetInfo(storage, "", info)) return false; + if (!info.IsDirectory()) { + FormatError(update_domain, "Not a directory: %s", + storage.MapUTF8("").c_str()); + return false; + } + ExcludeList exclude_list; UpdateDirectory(root, exclude_list, info); |