mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: add a condition if the argument of DomainToUnicode is empty
PR-URL: https://github.com/nodejs/node/pull/49097 Refs: https://github.com/nodejs/node/pull/46410 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
This commit is contained in:
@@ -100,6 +100,11 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK(args[0]->IsString());
|
||||
|
||||
std::string input = Utf8Value(env->isolate(), args[0]).ToString();
|
||||
if (input.empty()) {
|
||||
return args.GetReturnValue().Set(
|
||||
String::NewFromUtf8(env->isolate(), "").ToLocalChecked());
|
||||
}
|
||||
|
||||
// It is important to have an initial value that contains a special scheme.
|
||||
// Since it will change the implementation of `set_hostname` according to URL
|
||||
// spec.
|
||||
|
||||
Reference in New Issue
Block a user