From 34c870e9f0b21da1cd220754b68b91ef7a19c82e 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 PR-URL: https://github.com/nodejs/node/pull/35716 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Rich Trott --- 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 020b570cea3304..217854255d2806 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -423,12 +423,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