Skip to content

Commit e6ab2d9

Browse files
trevnorrisrvagg
authored andcommitted
buffer: fix not return on error
Throwing a JS error from C++ does not mean the function will return early. This must be done manually. Also remove extraneous comment no longer relevant. Fix: 2903030 "buffer: switch API to return MaybeLocal<T>" PR-URL: #2225 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 9f727f5 commit e6ab2d9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/node_buffer.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ MaybeLocal<Object> Copy(Isolate* isolate, const char* data, size_t length) {
287287
}
288288

289289

290-
// Make a copy of "data". Why this isn't called "Copy", we'll never know.
291290
MaybeLocal<Object> New(Environment* env, const char* data, size_t length) {
292291
EscapableHandleScope scope(env->isolate());
293292

@@ -474,7 +473,7 @@ void Slice(const FunctionCallbackInfo<Value>& args) {
474473
Maybe<bool> mb =
475474
ui->SetPrototype(env->context(), env->buffer_prototype_object());
476475
if (!mb.FromMaybe(false))
477-
env->ThrowError("Unable to set Object prototype");
476+
return env->ThrowError("Unable to set Object prototype");
478477
args.GetReturnValue().Set(ui);
479478
}
480479

0 commit comments

Comments
 (0)