mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
fix Task::all when tasks is empty
This commit is contained in:
parent
16636e8e7b
commit
9eb7064fcd
2 changed files with 5 additions and 3 deletions
|
@ -339,6 +339,11 @@ namespace geode {
|
|||
static Task<std::vector<T*>, std::monostate> all(std::vector<Task<T, NP>>&& tasks, std::string const& name = "<Multiple Tasks>") {
|
||||
using AllTask = Task<std::vector<T*>, std::monostate>;
|
||||
|
||||
// If there are no tasks, return an immediate task that does nothing
|
||||
if (tasks.empty()) {
|
||||
return AllTask::immediate({}, name);
|
||||
}
|
||||
|
||||
// Create a new supervising task for all of the provided tasks
|
||||
auto task = AllTask(AllTask::Handle::create(name));
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ SuggestedModListSource::ProviderTask SuggestedModListSource::fetchPage(size_t pa
|
|||
for (auto problem : Loader::get()->getRecommendations()) {
|
||||
tasks.push_back(loadModSuggestion(problem));
|
||||
}
|
||||
if (tasks.empty()) {
|
||||
return ProviderTask::immediate(Ok(ProvidedMods()), {});
|
||||
}
|
||||
return LoadModSuggestionTask::all(std::move(tasks)).map(
|
||||
[query = m_query](auto* results) -> ProviderTask::Value {
|
||||
auto content = ProvidedMods();
|
||||
|
|
Loading…
Reference in a new issue