Skip to content

Commit

Permalink
src: improve error handling in tty_wrap.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Feb 26, 2025
1 parent 46ac7a5 commit 08d83ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tty_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) {

if (err == 0) {
Local<Array> a = args[0].As<Array>();
a->Set(env->context(), 0, Integer::New(env->isolate(), width)).Check();
a->Set(env->context(), 1, Integer::New(env->isolate(), height)).Check();
if (a->Set(env->context(), 0, Integer::New(env->isolate(), width))
.IsNothing() ||
a->Set(env->context(), 1, Integer::New(env->isolate(), height))
.IsNothing()) {
return;
}
}

args.GetReturnValue().Set(err);
Expand Down

0 comments on commit 08d83ef

Please sign in to comment.