Commit dac071ed authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #4202 from PhilLab:patch-5

parents 76296fb6 2b7637df
...@@ -87,7 +87,7 @@ String::String(const std::string& str, size_t pos, size_t len) ...@@ -87,7 +87,7 @@ String::String(const std::string& str, size_t pos, size_t len)
: cstr_(0), len_(0) : cstr_(0), len_(0)
{ {
size_t strlen = str.size(); size_t strlen = str.size();
pos = max(pos, strlen); pos = min(pos, strlen);
len = min(strlen - pos, len); len = min(strlen - pos, len);
if (!len) return; if (!len) return;
memcpy(allocate(len), str.c_str() + pos, len); memcpy(allocate(len), str.c_str() + pos, len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment