AK: Avoid nullptr deref in DeprecatedString(DeprecatedFlyString const&)

Prior to this commit, constructing a DS from a null DFS would cause a
nullptr deref, which broke (at least) Profiler.
This commit converts the null DFS to an empty DS, avoiding the nullptr
deref (until DFS loses its null state, or we decide to not make it
convertible to a DS).
This commit is contained in:
Ali Mohammad Pur 2023-10-16 15:35:11 +03:30 committed by Tim Flynn
parent a8f0fa5dd4
commit 867f7da017
Notes: sideshowbarker 2024-07-17 10:39:39 +09:00

View file

@ -374,7 +374,7 @@ DeprecatedString escape_html_entities(StringView html)
}
DeprecatedString::DeprecatedString(DeprecatedFlyString const& string)
: m_impl(*string.impl())
: m_impl(*(string.impl() ?: &StringImpl::the_empty_stringimpl()))
{
}