mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 17:43:54 +08:00
replay: fix segfault in Replay::queueSegment (#31902)
old-commit-hash: e79cb0edaf
This commit is contained in:
@@ -225,7 +225,7 @@ void Replay::queueSegment() {
|
||||
if (cur == segments_.end()) return;
|
||||
|
||||
auto begin = std::prev(cur, std::min<int>(segment_cache_limit / 2, std::distance(segments_.begin(), cur)));
|
||||
auto end = std::next(begin, std::min<int>(segment_cache_limit, segments_.size()));
|
||||
auto end = std::next(begin, std::min<int>(segment_cache_limit, std::distance(begin, segments_.end())));
|
||||
// load one segment at a time
|
||||
auto it = std::find_if(cur, end, [](auto &it) { return !it.second || !it.second->isLoaded(); });
|
||||
if (it != end && !it->second) {
|
||||
|
||||
Reference in New Issue
Block a user