◐ Shell
clean mode source ↗

src: improve error handling in `tty_wrap.cc` · nodejs/node@96b2bfb

Original file line numberDiff line numberDiff line change

@@ -100,8 +100,12 @@ void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) {

100100
101101

if (err == 0) {

102102

Local<Array> a = args[0].As<Array>();

103-

a->Set(env->context(), 0, Integer::New(env->isolate(), width)).Check();

104-

a->Set(env->context(), 1, Integer::New(env->isolate(), height)).Check();

103+

if (a->Set(env->context(), 0, Integer::New(env->isolate(), width))

104+

.IsNothing() ||

105+

a->Set(env->context(), 1, Integer::New(env->isolate(), height))

106+

.IsNothing()) {

107+

return;

108+

}

105109

}

106110
107111

args.GetReturnValue().Set(err);