diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-01 12:28:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-01 12:28:54 +0300 |
commit | 356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869 (patch) | |
tree | 788266bf378895c065e00a83b2a58cf8427f63d4 /src/gui/widgets/setupitem.cpp | |
parent | 1bf7aa922ded964035f85444b42c8f8aa4668e92 (diff) | |
download | plus-356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869.tar.gz plus-356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869.tar.bz2 plus-356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869.tar.xz plus-356ac7c52ae8cebc5df4d08e1e2cf30cfd66d869.zip |
improve size() usage in setupitem.
Diffstat (limited to 'src/gui/widgets/setupitem.cpp')
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 10 |
1 files 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<int>(mSlider->getValue()) - mMin; if (val < 0) + { val = 0; - else if (val >= static_cast<signed>(mValues->size())) - val = static_cast<signed>(mValues->size()) - 1; + } + else + { + const int sz = static_cast<signed>(mValues->size()); + if (val >= sz) + val = sz - 1; + } std::string str = mValues->at(val); mLabel2->setCaption(str); } |