fix(progressbar): Safety check

Fixes #152
This commit is contained in:
Michael Carlberg 2016-11-08 13:55:16 +01:00
parent 22328c4b13
commit a8e902c579

View File

@ -62,7 +62,7 @@ namespace drawtypes {
} else if (m_gradient) { } else if (m_gradient) {
size_t color = 0; size_t color = 0;
for (size_t i = 0; i < fill_width; i++) { for (size_t i = 0; i < fill_width; i++) {
if (i % m_colorstep == 0) if (i % m_colorstep == 0 && color < m_colors.size())
m_fill->m_foreground = m_colors[color++]; m_fill->m_foreground = m_colors[color++];
m_builder->node(m_fill); m_builder->node(m_fill);
} }