From 36f78f4c1cbe0c0dd2a83f6b1dba534a9d722a49 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Tue, 2 Jun 2015 11:09:03 -0600 Subject: buffer: switch API to return MaybeLocal Instead of aborting in case of internal failure, return an empty Local. Using the MaybeLocal API, users must check their return values. PR-URL: https://github.com/nodejs/io.js/pull/1825 Reviewed-By: Ben Noordhuis --- src/string_bytes.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/string_bytes.cc') diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 0bdb8aad91..36525a73ac 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -19,6 +19,7 @@ using v8::Handle; using v8::HandleScope; using v8::Isolate; using v8::Local; +using v8::Object; using v8::String; using v8::Value; @@ -702,7 +703,10 @@ Local StringBytes::Encode(Isolate* isolate, Local val; switch (encoding) { case BUFFER: - return scope.Escape(Buffer::New(isolate, buf, buflen)); + { + Local vbuf = Buffer::New(isolate, buf, buflen).ToLocalChecked(); + return scope.Escape(vbuf); + } case ASCII: if (contains_non_ascii(buf, buflen)) { -- cgit v1.2.3