From 96b2bfb88cb0a15d0fe73a736436db448ab012e1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 25 Feb 2025 16:12:56 -0800 Subject: [PATCH] src: improve error handling in `tty_wrap.cc` PR-URL: https://github.com/nodejs/node/pull/57211 Reviewed-By: Yagiz Nizipli Reviewed-By: Matthew Aitken Reviewed-By: Antoine du Hamel --- src/tty_wrap.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index d2bd9c383ab..f43a4c81f5d 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -100,8 +100,12 @@ void TTYWrap::GetWindowSize(const FunctionCallbackInfo& args) { if (err == 0) { Local a = args[0].As(); - 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);