summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/copynpaste.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index db14dd3c7..8af847a21 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -365,8 +365,9 @@ bool retrieveBuffer(std::string& text, size_t& pos)
if (data)
{
// check cursor position
- if (pos > text.size())
- pos = text.size();
+ const size_t sz = text.size();
+ if (pos > sz)
+ pos = sz;
text.insert(pos, data);
pos += strlen(data);