diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-01 12:10:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-01 12:10:38 +0300 |
commit | 4d580a22e13f003e8835adba54c78bab1a2a3f5a (patch) | |
tree | 57db5121bc27ebf1082542d76cef2ec7c3d2e28d /src/utils | |
parent | 827dbd86772860f3b4dfa268c1e606ddbee82c0d (diff) | |
download | ManaVerse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.tar.gz ManaVerse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.tar.bz2 ManaVerse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.tar.xz ManaVerse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.zip |
improve size() usage in copynpaste.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/copynpaste.cpp | 5 |
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); |