mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibGUI: Fix crash when text_in_range() was called on an empty document
This commit is contained in:
parent
4f34a78337
commit
2b269b27e7
Notes:
sideshowbarker
2024-07-18 21:20:37 +09:00
Author: https://github.com/ngc6302h
Commit: 2b269b27e7
Pull-request: https://github.com/SerenityOS/serenity/pull/5772
Issue: https://github.com/SerenityOS/serenity/issues/5760
Issue: https://github.com/SerenityOS/serenity/issues/5768
Reviewed-by: https://github.com/awesomekling
1 changed files with 2 additions and 0 deletions
|
@ -315,6 +315,8 @@ String TextDocument::text() const
|
||||||
|
|
||||||
String TextDocument::text_in_range(const TextRange& a_range) const
|
String TextDocument::text_in_range(const TextRange& a_range) const
|
||||||
{
|
{
|
||||||
|
if (is_empty())
|
||||||
|
return String("");
|
||||||
auto range = a_range.normalized();
|
auto range = a_range.normalized();
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue