summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/textfield.cpp5
1 files 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<int>(mText.size());
+ const unsigned int sz = mText.size();
+ if (position > sz)
+ mCaretPosition = static_cast<int>(sz);
else
mCaretPosition = position;