diff options
Diffstat (limited to 'src/tty_wrap.cc')
-rw-r--r-- | src/tty_wrap.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 6e91dbcd74..319a74fd36 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -90,7 +90,10 @@ void TTYWrap::IsTTY(const FunctionCallbackInfo<Value>& args) { void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); - TTYWrap* wrap = Unwrap<TTYWrap>(args.Holder()); + TTYWrap* wrap; + ASSIGN_OR_RETURN_UNWRAP(&wrap, + args.Holder(), + args.GetReturnValue().Set(UV_EBADF)); CHECK(args[0]->IsArray()); int width, height; @@ -107,7 +110,10 @@ void TTYWrap::GetWindowSize(const FunctionCallbackInfo<Value>& args) { void TTYWrap::SetRawMode(const FunctionCallbackInfo<Value>& args) { - TTYWrap* wrap = Unwrap<TTYWrap>(args.Holder()); + TTYWrap* wrap; + ASSIGN_OR_RETURN_UNWRAP(&wrap, + args.Holder(), + args.GetReturnValue().Set(UV_EBADF)); int err = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue()); args.GetReturnValue().Set(err); } |