mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 17:23:20 +00:00
Add default path when creating new source
This commit is contained in:
parent
14d04f6a77
commit
d6c781faa2
7 changed files with 24 additions and 6 deletions
2
external/evalyte-cpp-common
vendored
2
external/evalyte-cpp-common
vendored
|
@ -1 +1 @@
|
|||
Subproject commit b154a3351b89a5962a2bed2feae683b3a8009857
|
||||
Subproject commit 20e766badc8f400ac7db8487486b5e8990cefbbe
|
8
external/mirai-core/src/Mirai.cpp
vendored
8
external/mirai-core/src/Mirai.cpp
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue