AK: Don't return null from String[View]::substring_view()
We expect the result to be usable with the StringView::substring_view_starting_*_substring() methods. See https://github.com/SerenityOS/serenity/pull/938
This commit is contained in:
parent
b553a86048
commit
7ad9bfbc68
Notes:
sideshowbarker
2024-07-19 10:04:06 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/7ad9bfbc687 Pull-request: https://github.com/SerenityOS/serenity/pull/1076
2 changed files with 0 additions and 4 deletions
|
@ -99,8 +99,6 @@ String String::substring(size_t start, size_t length) const
|
||||||
|
|
||||||
StringView String::substring_view(size_t start, size_t length) const
|
StringView String::substring_view(size_t start, size_t length) const
|
||||||
{
|
{
|
||||||
if (!length)
|
|
||||||
return {};
|
|
||||||
ASSERT(m_impl);
|
ASSERT(m_impl);
|
||||||
ASSERT(start + length <= m_impl->length());
|
ASSERT(start + length <= m_impl->length());
|
||||||
// FIXME: This needs some input bounds checking.
|
// FIXME: This needs some input bounds checking.
|
||||||
|
|
|
@ -105,8 +105,6 @@ bool StringView::ends_with(const StringView& str) const
|
||||||
|
|
||||||
StringView StringView::substring_view(size_t start, size_t length) const
|
StringView StringView::substring_view(size_t start, size_t length) const
|
||||||
{
|
{
|
||||||
if (!length)
|
|
||||||
return {};
|
|
||||||
ASSERT(start + length <= m_length);
|
ASSERT(start + length <= m_length);
|
||||||
return { m_characters + start, length };
|
return { m_characters + start, length };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue