From 4d580a22e13f003e8835adba54c78bab1a2a3f5a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Jul 2013 12:10:38 +0300 Subject: improve size() usage in copynpaste. --- src/utils/copynpaste.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils/copynpaste.cpp') 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); -- cgit v1.2.3-70-g09d2