From 64a3b2d6da9718d15eae7fab5dc71c26ff5ee34b Mon Sep 17 00:00:00 2001
From: ronso0 <ronso0@mixxx.org>
Date: Tue, 8 Oct 2024 22:42:14 +0200
Subject: [PATCH] (fix) Controllers: return from loadSettings() when there's no
 mapping file

---
 src/controllers/legacycontrollermapping.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/controllers/legacycontrollermapping.cpp b/src/controllers/legacycontrollermapping.cpp
index 198487fa2f7f..dcdb515bfe2d 100644
--- a/src/controllers/legacycontrollermapping.cpp
+++ b/src/controllers/legacycontrollermapping.cpp
@@ -11,7 +11,11 @@ const QString kControllerSettingsResourcePathSubst = QStringLiteral("%RESOURCE_P
 void LegacyControllerMapping::loadSettings(UserSettingsPointer pConfig,
         const QString& controllerName) const {
     auto mappingFile = QFileInfo(m_filePath);
-    DEBUG_ASSERT(mappingFile.exists());
+    if (!mappingFile.exists()) {
+        // This happens when we start the MIDI Learning Wizard with a new (empty)
+        // mapping, or when the mapping file has been removed manually by the user.
+        return;
+    }
     QString controllerPath =
             mappingFile.absoluteFilePath()
                     .replace(pConfig->getSettingsPath(),