From a8e902c579ea66ac00d1f8a5633a57d6acd6aa6c Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 8 Nov 2016 13:55:16 +0100 Subject: [PATCH] fix(progressbar): Safety check Fixes #152 --- src/drawtypes/progressbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drawtypes/progressbar.cpp b/src/drawtypes/progressbar.cpp index 2fb90bc2..4d568896 100644 --- a/src/drawtypes/progressbar.cpp +++ b/src/drawtypes/progressbar.cpp @@ -62,7 +62,7 @@ namespace drawtypes { } else if (m_gradient) { size_t color = 0; 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_builder->node(m_fill); }