From f2016affa1d6a63d644f125802b0bfd1c1c20dfa Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 20 Oct 2020 12:14:05 +0200 Subject: [PATCH] src: use MaybeLocal.ToLocal instead of IsEmpty --- src/node_buffer.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index b2fa0ef20174a9..28ded0e3010116 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -424,12 +424,13 @@ MaybeLocal New(Environment* env, True(env->isolate())).IsNothing()) { return Local(); } - MaybeLocal ui = Buffer::New(env, ab, 0, length); + MaybeLocal maybe_ui = Buffer::New(env, ab, 0, length); - if (ui.IsEmpty()) + Local ui; + if (!maybe_ui.ToLocal(&ui)) return MaybeLocal(); - return scope.Escape(ui.ToLocalChecked()); + return scope.Escape(ui); } // Warning: This function needs `data` to be allocated with malloc() and not