[wpilibc] Fix uninitialized variable in Trajectory class (#2495)

Valgrind caught this one. If you default initialize a Trajectory, it
doesn't initialize m_totalTime. This means a subsequent call to
Trajectory::TotalTime() returns the value of an uninitialized variable.
3512's software was using 0_s as a sentinel value for when a trajectory
was empty. We didn't notice a problem before because Linux zero-inits
memory.
This commit is contained in:
Tyler Veness
2020-04-26 08:03:17 -07:00
committed by GitHub
parent 4b77b0773e
commit 3011ebe547

View File

@@ -129,7 +129,7 @@ class Trajectory {
private:
std::vector<State> m_states;
units::second_t m_totalTime;
units::second_t m_totalTime = 0_s;
/**
* Linearly interpolates between two values.