summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibRegex/RegexMatch.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h
index ddf402c9f7..7359fcf785 100644
--- a/Userland/Libraries/LibRegex/RegexMatch.h
+++ b/Userland/Libraries/LibRegex/RegexMatch.h
@@ -172,6 +172,9 @@ public:
return new_views;
},
[](Utf32View view) {
+ if (view.is_empty())
+ return Vector<RegexStringView> { view };
+
Vector<RegexStringView> views;
u32 newline = '\n';
while (!view.is_empty()) {
@@ -187,6 +190,9 @@ public:
return views;
},
[](Utf16View view) {
+ if (view.is_empty())
+ return Vector<RegexStringView> { view };
+
Vector<RegexStringView> views;
u16 newline = '\n';
while (!view.is_empty()) {
@@ -202,6 +208,9 @@ public:
return views;
},
[](Utf8View const& view) {
+ if (view.is_empty())
+ return Vector<RegexStringView> { view };
+
Vector<RegexStringView> views;
auto it = view.begin();
auto previous_newline_position_it = it;