Skip to content

Commit 96b2bfb

Browse files
jasnelladuh95
authored andcommitted
src: improve error handling in tty_wrap.cc
PR-URL: #57211 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent f845ad9 commit 96b2bfb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tty_wrap.cc

+6-2
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);

0 commit comments

Comments
 (0)