From 63406efcd8f395368b3dc5d1d77e05077d1f5550 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 6 Jul 2018 18:27:17 +0200
Subject: [PATCH] db/update/ExcludeList: allow comments only at start of line

---
 NEWS                          | 1 +
 src/db/update/ExcludeList.cxx | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index 8b8e6591a..2c68bfa10 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ ver 0.20.21 (not yet released)
 * database
   - proxy: add "password" setting
   - proxy: support tags "ArtistSort", "AlbumArtistSort", "AlbumSort"
+  - simple: allow .mpdignore comments only at start of line
 * output
   - httpd: remove broken DLNA support code
 
diff --git a/src/db/update/ExcludeList.cxx b/src/db/update/ExcludeList.cxx
index ec44250eb..8f37d09f5 100644
--- a/src/db/update/ExcludeList.cxx
+++ b/src/db/update/ExcludeList.cxx
@@ -38,12 +38,8 @@
 inline void
 ExcludeList::ParseLine(char *line) noexcept
 {
-	char *p = strchr(line, '#');
-	if (p != nullptr)
-		*p = 0;
-
-	p = Strip(line);
-	if (*p != 0)
+	char *p = Strip(line);
+	if (*p != 0 && *p != '#')
 		patterns.emplace_front(p);
 }
 
-- 
2.24.1