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

Unified Diff: chrome/renderer/module_system.cc

Issue 10873095: *v8::String::Utf8Value can return NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: whoops Created 8 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/module_system.cc
diff --git a/chrome/renderer/module_system.cc b/chrome/renderer/module_system.cc
index 97a3bd38d9e32d549a984a157ed67e37762945c1..43a57472620091f3da36bb71fd59e230c160dac6 100644
--- a/chrome/renderer/module_system.cc
+++ b/chrome/renderer/module_system.cc
@@ -61,6 +61,8 @@ bool ModuleSystem::IsPresentInCurrentContext() {
// static
void ModuleSystem::DumpException(const v8::TryCatch& try_catch) {
+ v8::HandleScope handle_scope;
+
v8::Handle<v8::Message> message(try_catch.Message());
if (message.IsEmpty()) {
LOG(ERROR) << "try_catch has no message";
@@ -78,8 +80,13 @@ void ModuleSystem::DumpException(const v8::TryCatch& try_catch) {
error_message = *v8::String::Utf8Value(message->Get());
std::string stack_trace = "<stack trace unavailable>";
- if (!try_catch.StackTrace().IsEmpty())
- stack_trace = *v8::String::Utf8Value(try_catch.StackTrace());
+ if (!try_catch.StackTrace().IsEmpty()) {
+ v8::String::Utf8Value stack_value(try_catch.StackTrace());
+ if (*stack_value)
+ stack_trace.assign(*stack_value, stack_value.length());
+ else
+ stack_trace = "<could not convert stack trace to string>";
+ }
LOG(ERROR) << "[" << resource_name << "(" << message->GetLineNumber() << ")] "
<< error_message
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698