aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-12-10 02:46:55 +0100
committerGitHub <noreply@github.com>2022-12-10 02:46:55 +0100
commit590875d022c58709b3bfb5e78aafa2318fe009d1 (patch)
tree476c2421733b5c7a90544d8be700a3a946dbb49a /launcher
parentcb0339b4920011a915fcdb77820b55211c0103fc (diff)
parent8f3023776521a8b475e3a76edb4f1423d6368851 (diff)
downloadPrismLauncher-590875d022c58709b3bfb5e78aafa2318fe009d1.tar.gz
PrismLauncher-590875d022c58709b3bfb5e78aafa2318fe009d1.tar.bz2
PrismLauncher-590875d022c58709b3bfb5e78aafa2318fe009d1.zip
Merge pull request #575 from Ryex/blockedmods-only-drop-local
Prevent potental crash if droping non local files in BlockedModsDialog
Diffstat (limited to 'launcher')
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp
index 346ceff2..8b49bd1a 100644
--- a/launcher/ui/dialogs/BlockedModsDialog.cpp
+++ b/launcher/ui/dialogs/BlockedModsDialog.cpp
@@ -84,7 +84,15 @@ void BlockedModsDialog::dragEnterEvent(QDragEnterEvent* e)
void BlockedModsDialog::dropEvent(QDropEvent* e)
{
- for (const QUrl& url : e->mimeData()->urls()) {
+ for (QUrl& url : e->mimeData()->urls()) {
+ if (url.scheme().isEmpty()) { // ensure isLocalFile() works correctly
+ url.setScheme("file");
+ }
+
+ if (!url.isLocalFile()) { // can't drop external files here.
+ continue;
+ }
+
QString filePath = url.toLocalFile();
qDebug() << "[Blocked Mods Dialog] Dropped file:" << filePath;
addHashTask(filePath);