From 7ad9bfbc687e1dc42747febdc4bc7a3b9a27aa4a Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Tue, 14 Jan 2020 14:03:30 +0300 Subject: [PATCH] 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 --- AK/String.cpp | 2 -- AK/StringView.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/AK/String.cpp b/AK/String.cpp index 2c011e279e..b9f6beac93 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -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 { - if (!length) - return {}; ASSERT(m_impl); ASSERT(start + length <= m_impl->length()); // FIXME: This needs some input bounds checking. diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 54c1e21dcc..ba34ebabc2 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -105,8 +105,6 @@ bool StringView::ends_with(const StringView& str) const StringView StringView::substring_view(size_t start, size_t length) const { - if (!length) - return {}; ASSERT(start + length <= m_length); return { m_characters + start, length }; }