From 32052b3198c7a47b8a20f301c5ec003d0a748c40 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 14 Mar 2021 12:02:53 +0100 Subject: [PATCH] LibJS: Fix flags check in regexp_create() We need to check for undefined, not empty - otherwise it will literally use "undefined" as the flags, which will fail (Invalid RegExp flag 'n'). --- Userland/Libraries/LibJS/Runtime/RegExpObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp b/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp index 0ba76e530a..b3f49a2ca7 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp @@ -180,7 +180,7 @@ RegExpObject* regexp_create(GlobalObject& global_object, Value pattern, Value fl return nullptr; } String f; - if (flags.is_empty()) { + if (flags.is_undefined()) { f = String::empty(); } else { f = flags.to_string(global_object);