1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

AK: Make String::substring() return non-null for 0-length strings

This also makes String::split() give non-null strings when keep_empty is
true.
This commit is contained in:
Peter Elliott 2020-07-25 21:09:33 -06:00 committed by Andreas Kling
parent 9dcbb263f1
commit e57a432118
2 changed files with 26 additions and 1 deletions

View file

@ -125,7 +125,7 @@ String String::isolated_copy() const
String String::substring(size_t start, size_t length) const
{
if (!length)
return {};
return "";
ASSERT(m_impl);
ASSERT(start + length <= m_impl->length());
// FIXME: This needs some input bounds checking.