From 356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Jul 2013 12:28:54 +0300 Subject: improve size() usage in setupitem. --- src/gui/widgets/setupitem.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 8be4696e1..8be7dd520 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -895,9 +895,15 @@ void SetupItemSlider2::updateLabel() { int val = static_cast(mSlider->getValue()) - mMin; if (val < 0) + { val = 0; - else if (val >= static_cast(mValues->size())) - val = static_cast(mValues->size()) - 1; + } + else + { + const int sz = static_cast(mValues->size()); + if (val >= sz) + val = sz - 1; + } std::string str = mValues->at(val); mLabel2->setCaption(str); } -- cgit v1.2.3-70-g09d2