Skip to content

Commit 8c33731

Browse files
Jungku Leetargos
Jungku Lee
authored andcommitted
src: add a condition if the argument of DomainToUnicode is empty
PR-URL: #49097 Refs: #46410 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Deokjin Kim <[email protected]>
1 parent 9e1c531 commit 8c33731

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/node_url.cc

Lines changed: 5 additions & 0 deletions
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)