aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft')
-rw-r--r--launcher/minecraft/mod/Mod.cpp7
-rw-r--r--launcher/minecraft/mod/Mod.h1
-rw-r--r--launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp10
3 files changed, 12 insertions, 6 deletions
diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp
index 7b560845..ef3699e8 100644
--- a/launcher/minecraft/mod/Mod.cpp
+++ b/launcher/minecraft/mod/Mod.cpp
@@ -20,6 +20,8 @@
#include <FileSystem.h>
#include <QDebug>
+
+#include "Application.h"
#include "MetadataHandler.h"
namespace {
@@ -174,8 +176,7 @@ void Mod::finishResolvingWithDetails(std::shared_ptr<ModDetails> details)
m_resolved = true;
m_localDetails = details;
- if (fromMetadata() && m_temp_metadata->isValid()) {
- m_localDetails->metadata = m_temp_metadata;
- m_temp_metadata.reset();
+ if (fromMetadata() && m_temp_metadata->isValid() && m_localDetails.get()) {
+ m_localDetails->metadata.swap(m_temp_metadata);
}
}
diff --git a/launcher/minecraft/mod/Mod.h b/launcher/minecraft/mod/Mod.h
index 0d49d94b..1e7ed1ed 100644
--- a/launcher/minecraft/mod/Mod.h
+++ b/launcher/minecraft/mod/Mod.h
@@ -20,7 +20,6 @@
#include <QList>
#include "ModDetails.h"
-#include "minecraft/mod/MetadataHandler.h"
class Mod
{
diff --git a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp
index 5afbb08a..03a17461 100644
--- a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp
+++ b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp
@@ -34,8 +34,14 @@ void ModFolderLoadTask::getFromMetadata()
if (entry == "." || entry == "..")
continue;
- entry.chop(5); // Remove .toml at the end
- Mod mod(m_mods_dir, Metadata::get(m_index_dir, entry));
+ auto metadata = Metadata::get(m_index_dir, entry);
+ // TODO: Don't simply return. Instead, show to the user that the metadata is there, but
+ // it's not currently 'installed' (i.e. there's no JAR file yet).
+ if(!metadata.isValid()){
+ return;
+ }
+
+ Mod mod(m_mods_dir, metadata);
m_result->mods[mod.internal_id()] = mod;
}
}