From 222d6c7b11263bea997a127ca24b491370e090d6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Jul 2013 12:30:48 +0300 Subject: improve size() usage in textfield. --- src/gui/widgets/textfield.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 006fb4503..b4aace3cf 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -519,8 +519,9 @@ void TextField::fixScroll() void TextField::setCaretPosition(unsigned int position) { - if (position > mText.size()) - mCaretPosition = static_cast(mText.size()); + const unsigned int sz = mText.size(); + if (position > sz) + mCaretPosition = static_cast(sz); else mCaretPosition = position; -- cgit v1.2.3-60-g2f50