Skip to content

Commit adf338b

Browse files
author
pluris
committed
src: add a condition if the argument of DomainToUnicode is empty
1 parent c021b27 commit adf338b

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
@@ -100,6 +100,11 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
100100
CHECK(args[0]->IsString());
101101

102102
std::string input = Utf8Value(env->isolate(), args[0]).ToString();
103+
if (input.empty()) {
104+
return args.GetReturnValue().Set(
105+
String::NewFromUtf8(env->isolate(), "").ToLocalChecked());
106+
}
107+
103108
// It is important to have an initial value that contains a special scheme.
104109
// Since it will change the implementation of `set_hostname` according to URL
105110
// spec.

0 commit comments

Comments
 (0)