Add default path when creating new source

This commit is contained in:
Vyn 2024-11-04 12:36:18 +01:00
parent 14d04f6a77
commit d6c781faa2
7 changed files with 24 additions and 6 deletions

@ -1 +1 @@
Subproject commit b154a3351b89a5962a2bed2feae683b3a8009857
Subproject commit 20e766badc8f400ac7db8487486b5e8990cefbbe

View file

@ -136,10 +136,14 @@ std::vector<std::unique_ptr<Source>> &Mirai::getSources()
Source *Mirai::getSourceById(int id)
{
if (id >= sources_.size()) {
auto source = std::ranges::find_if(sources_, [&](const std::unique_ptr<Source> &source) {
return source->id == id;
});
assert(source != sources_.end()); // This should not happen
if (source == sources_.end()) {
return nullptr;
}
return sources_.at(id).get();
return source->get();
}
} // namespace mirai