From d3cd11612f01f73de21c130f9554343b736b56f5 Mon Sep 17 00:00:00 2001 From: captivator <84224501+qaptivator@users.noreply.github.com> Date: Wed, 22 Apr 2026 01:33:40 +0300 Subject: [PATCH] fix: ignore non-existent or empty paths in processURLs Assisted-by: Gemini:3-Flash Signed-off-by: captivator <84224501+qaptivator@users.noreply.github.com> (cherry picked from commit 92eeeaf14fa81ae3e1f5f9d84aed6f875d64ce4b) --- launcher/ui/MainWindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index f4c170eb8..784250e52 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -931,6 +931,9 @@ void MainWindow::processURLs(QList urls) { // NOTE: This loop only processes one dropped file! for (auto& url : urls) { + if (url.isEmpty() || url.toString().trimmed().isEmpty()) + continue; + qDebug() << "Processing" << url; // The isLocalFile() check below doesn't work as intended without an explicit scheme. @@ -1125,6 +1128,11 @@ void MainWindow::processURLs(QList urls) auto localFileName = QDir::toNativeSeparators(local_url.toLocalFile()); QFileInfo localFileInfo(localFileName); + if (localFileName.isEmpty() || !localFileInfo.exists()) { + qDebug() << "Ignoring invalid path" << localFileName; + continue; + } + auto type = ResourceUtils::identify(localFileInfo); if (ModPlatform::ResourceTypeUtils::VALID_RESOURCES.count(type) == 0) { // probably instance/modpack