mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-04 04:16:57 +03:00
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 92eeeaf14f)
This commit is contained in:
parent
4f4bc59a44
commit
d3cd11612f
1 changed files with 8 additions and 0 deletions
|
|
@ -931,6 +931,9 @@ void MainWindow::processURLs(QList<QUrl> 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<QUrl> 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue