fix: prevent potental crash if droping non local files
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
cb0339b492
commit
8f30237765
@ -84,7 +84,15 @@ void BlockedModsDialog::dragEnterEvent(QDragEnterEvent* e)
|
|||||||
|
|
||||||
void BlockedModsDialog::dropEvent(QDropEvent* 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();
|
QString filePath = url.toLocalFile();
|
||||||
qDebug() << "[Blocked Mods Dialog] Dropped file:" << filePath;
|
qDebug() << "[Blocked Mods Dialog] Dropped file:" << filePath;
|
||||||
addHashTask(filePath);
|
addHashTask(filePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user