mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[glass] Fix PlotSeries::SetSource() (#3991)
This can be called in a delayed manner, so it's possible for m_size to already be at maximum, which results in writing past the end of the array. Instead, just call AppendValue().
This commit is contained in:
@@ -246,7 +246,7 @@ void PlotSeries::SetSource(DataSource* source) {
|
||||
m_source = source;
|
||||
|
||||
// add initial value
|
||||
m_data[m_size++] = ImPlotPoint{wpi::Now() * 1.0e-6, source->GetValue()};
|
||||
AppendValue(source->GetValue(), 0);
|
||||
|
||||
m_newValueConn = source->valueChanged.connect_connection(
|
||||
[this](double value, uint64_t time) { AppendValue(value, time); });
|
||||
|
||||
Reference in New Issue
Block a user