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').
This commit is contained in:
Linus Groh 2021-03-14 12:02:53 +01:00 committed by Andreas Kling
parent 6d2d8d091f
commit 32052b3198
Notes: sideshowbarker 2024-07-18 21:22:32 +09:00

View File

@ -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);