Skip to content

Commit de7b223

Browse files
committed
Fix crash in slider
1 parent ab3ea24 commit de7b223

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/widgets/widget_waveslider.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ void WaveSlider::DrawGeneratedWave(Canvas& canvas, const NRectf& rc)
178178
rcWorld.Adjust(8, 8, -8, -8);
179179
for (uint32_t x = 0; x < rcWorld.Width(); x++)
180180
{
181-
auto y = m_wave[size_t(x * m_wave.size() / rc.Width())];
181+
auto index = size_t(x * m_wave.size() / rc.Width());
182+
if (index >= m_wave.size())
183+
{
184+
continue;
185+
}
186+
auto y = m_wave[index];
182187
if (x == 0)
183188
{
184189
canvas.BeginStroke(glm::vec2(rcWorld.Left(), rcWorld.Center().y + y * rcWorld.Height() * 0.5f), 4.0f, waveColor);

0 commit comments

Comments
 (0)