Skip to content

Commit

Permalink
[sysid] Fix crash when all data is filtered out during analysis (wpil…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 authored Oct 12, 2024
1 parent 25c2e26 commit 7ebd45e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sysid/src/main/native/cpp/analysis/FilteringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,11 @@ static units::second_t GetMaxStepTime(
auto& dataset = it.getValue();

if (IsRaw(key) && wpi::contains(key, "dynamic")) {
auto duration = dataset.back().timestamp - dataset.front().timestamp;
if (duration > maxStepTime) {
maxStepTime = duration;
if (!dataset.empty()) {
auto duration = dataset.back().timestamp - dataset.front().timestamp;
if (duration > maxStepTime) {
maxStepTime = duration;
}
}
}
}
Expand Down

0 comments on commit 7ebd45e

Please sign in to comment.