Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: src/api.cc

Issue 16943006: V8 API: Add a missing NULL check into Isolate::GetCurrentContext(). (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9b1d01cd8f4ead1bab6e46f03c3ed362157f8c13..5cf43f4a551dd6ca46c955eb8b7953abfaee0ac7 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6538,10 +6538,11 @@ CpuProfiler* Isolate::GetCpuProfiler() {
v8::Local<v8::Context> Isolate::GetCurrentContext() {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
- i::Handle<i::Object> current = internal_isolate->native_context();
- if (current.is_null()) return Local<Context>();
- i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
- return Utils::ToLocal(context);
+ i::Context* context = internal_isolate->context();
+ if (context == NULL) return Local<Context>();
+ i::Context* native_context = context->global_object()->native_context();
+ if (native_context == NULL) return Local<Context>();
+ return Utils::ToLocal(i::Handle<i::Context>(native_context));
}
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698