fix(ModSource): fix bad unwrap in fetchValidTags
Some checks are pending
Build Binaries / Build Windows (push) Waiting to run
Build Binaries / Build macOS (push) Waiting to run
Build Binaries / Build Android (64-bit) (push) Waiting to run
Build Binaries / Build Android (32-bit) (push) Waiting to run
Build Binaries / Publish (push) Blocked by required conditions
Check CHANGELOG.md / Check CHANGELOG.md (push) Waiting to run

This commit is contained in:
Fleeym 2024-11-13 23:19:07 +02:00
parent 22a11b96e2
commit 01807fedc9

View file

@ -5,6 +5,7 @@
#include <Geode/ui/GeodeUI.hpp>
#include <server/DownloadManager.hpp>
#include <Geode/binding/GameObject.hpp>
#include <unordered_set>
LoadModSuggestionTask loadModSuggestion(LoadProblem const& problem) {
// Recommended / suggested are essentially the same thing for the purposes of this
@ -183,19 +184,22 @@ server::ServerRequest<std::unordered_set<std::string>> ModSource::fetchValidTags
return std::visit(makeVisitor {
[](Mod* mod) {
return server::getTags().map(
[mod](auto* result) -> Result<std::unordered_set<std::string>, server::ServerError> {
[mod](Result<std::unordered_set<std::string>, server::ServerError>* result)
-> Result<std::unordered_set<std::string>, server::ServerError> {
std::unordered_set<std::string> finalTags;
auto modTags = mod->getMetadata().getTags();
if (result->isOk()) {
std::unordered_set<std::string> fetched = result->unwrap();
// Filter out invalid tags
auto modTags = mod->getMetadata().getTags();
auto finalTags = std::unordered_set<std::string>();
for (auto& tag : modTags) {
if (result->unwrap().contains(tag)) {
for (std::string const& tag : modTags) {
if (fetched.contains(tag)) {
finalTags.insert(tag);
}
}
return Ok(finalTags);
}
return Ok(result->unwrap());
return Ok(finalTags);
},
[](server::ServerProgress* progress) {
return *progress;