1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

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

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