From cccf35d140e5d3525485bae4c1632b0e779be493 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 5 Jun 2018 21:56:28 +0200
Subject: [PATCH] storage/udisks: add missing MountWait() call to MapFS()

---
 src/storage/plugins/UdisksStorage.cxx | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/storage/plugins/UdisksStorage.cxx b/src/storage/plugins/UdisksStorage.cxx
index 98fb3dc5b..da1463da5 100644
--- a/src/storage/plugins/UdisksStorage.cxx
+++ b/src/storage/plugins/UdisksStorage.cxx
@@ -109,6 +109,12 @@ public:
 	std::string MapUTF8(const char *uri_utf8) const noexcept override;
 
 	AllocatedPath MapFS(const char *uri_utf8) const noexcept override {
+		try {
+			const_cast<UdisksStorage *>(this)->MountWait();
+		} catch (...) {
+			return nullptr;
+		}
+
 		return mounted_storage->MapFS(uri_utf8);
 	}