From 1a44258c9d6b16aa34df8be42f9ad167fc249c21 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 7 Apr 2024 21:25:08 +0300 Subject: [PATCH] Fixed crash on invalid curseforge link on import Signed-off-by: Trial97 (cherry picked from commit 9cc58fe62c776dd206bb6dd99c886ce491662214) --- launcher/ui/pages/modplatform/ImportPage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/launcher/ui/pages/modplatform/ImportPage.cpp b/launcher/ui/pages/modplatform/ImportPage.cpp index ae4bd49d7..ed7ebfad9 100644 --- a/launcher/ui/pages/modplatform/ImportPage.cpp +++ b/launcher/ui/pages/modplatform/ImportPage.cpp @@ -123,6 +123,10 @@ void ImportPage::updateState() // need to find the download link for the modpack // format of url curseforge://install?addonId=IDHERE&fileId=IDHERE QUrlQuery query(url); + if (query.allQueryItemValues("addonId").isEmpty() || query.allQueryItemValues("fileId").isEmpty()) { + qDebug() << "Invalid curseforge link:" << url; + return; + } auto addonId = query.allQueryItemValues("addonId")[0]; auto fileId = query.allQueryItemValues("fileId")[0]; auto array = std::make_shared();