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