5ddd382a9b
While likely very uncommon, this sanitizes the input and does nothing in the event of the length being equal to or less than zero, avoiding constructing a std::string when there's no need to. It also avoids an out-of-memory scenario, as a negative value would wrap around to its equivalent unsigned representation in std::string's constructor. e.g. If someone was silly and a length of -1 was specified, this would make a string with a length of 0xFFFFFFFFFFFFFFFF on a 64-bit platform, which will obviously eventually fail due to the allocation being way too large.