Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-07-22 22:06:54 +0300
committerRod Vagg <rod@vagg.org>2015-07-24 05:09:24 +0300
commit1ef0f704f18b1a8538f4ebdeee8f711f798fbf6b (patch)
treebba52a04f6c401972d34e7d2b519d59d049c03f9
parent5b1464f7571a740f5df2089bffe3ada271e5374e (diff)
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: https://github.com/nodejs/io.js/pull/2225 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
-rw-r--r--src/node_buffer.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 78d0f951d6d..e6b2aac0237 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -287,7 +287,6 @@ MaybeLocal<Object> Copy(Isolate* isolate, const char* data, size_t length) {
}
-// Make a copy of "data". Why this isn't called "Copy", we'll never know.
MaybeLocal<Object> New(Environment* env, const char* data, size_t length) {
EscapableHandleScope scope(env->isolate());
@@ -474,7 +473,7 @@ void Slice(const FunctionCallbackInfo<Value>& args) {
Maybe<bool> mb =
ui->SetPrototype(env->context(), env->buffer_prototype_object());
if (!mb.FromMaybe(false))
- env->ThrowError("Unable to set Object prototype");
+ return env->ThrowError("Unable to set Object prototype");
args.GetReturnValue().Set(ui);
}