Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 2ef58fdb32f3b7f006678084f9583cbe24e1d1da..060914a8d84973d0cfae15f091741ba0da9795d1 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -2315,13 +2315,11 @@ Local<Value> JSON::Parse(Local<String> json_string) { |
i::Handle<i::String> source = i::Handle<i::String>( |
FlattenGetString(Utils::OpenHandle(*json_string))); |
EXCEPTION_PREAMBLE(isolate); |
+ i::MaybeHandle<i::Object> maybe_result = |
+ source->IsSeqOneByteString() ? i::JsonParser<true>::Parse(source) |
+ : i::JsonParser<false>::Parse(source); |
i::Handle<i::Object> result; |
- if (source->IsSeqOneByteString()) { |
- result = i::JsonParser<true>::Parse(source); |
- } else { |
- result = i::JsonParser<false>::Parse(source); |
- } |
- has_pending_exception = result.is_null(); |
+ has_pending_exception = !maybe_result.ToHandle(&result); |
EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); |
return Utils::ToLocal( |
i::Handle<i::Object>::cast(scope.CloseAndEscape(result))); |