Skip to content

Commit d4dcab4

Browse files
committed
src: add a condition if the argument of DomainToUnicode is
PR-URL: nodejs/node#49097 Refs: nodejs/node#46410 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
1 parent 36dbbc7 commit d4dcab4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

graal-nodejs/src/node_url.cc

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
9595
CHECK(args[0]->IsString());
9696

9797
std::string input = Utf8Value(env->isolate(), args[0]).ToString();
98+
if (input.empty()) {
99+
return args.GetReturnValue().Set(
100+
String::NewFromUtf8(env->isolate(), "").ToLocalChecked());
101+
}
102+
98103
// It is important to have an initial value that contains a special scheme.
99104
// Since it will change the implementation of `set_hostname` according to URL
100105
// spec.

0 commit comments

Comments
 (0)