Fix crash in shell.cc when reporting exceptions that aren't Errors

BUG=chromium:534746
R=vogelheim@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1410333004

Cr-Commit-Position: refs/heads/master@{#31414}
This commit is contained in:
jochen 2015-10-20 07:33:46 -07:00 committed by Commit bot
parent b2abc0e3ad
commit 1440cd3d83

View File

@ -412,9 +412,11 @@ void ReportException(v8::Isolate* isolate, v8::TryCatch* try_catch) {
fprintf(stderr, "^");
}
fprintf(stderr, "\n");
v8::String::Utf8Value stack_trace(
try_catch->StackTrace(context).ToLocalChecked());
if (stack_trace.length() > 0) {
v8::Local<v8::Value> stack_trace_string;
if (try_catch->StackTrace(context).ToLocal(&stack_trace_string) &&
stack_trace_string->IsString() &&
v8::Local<v8::String>::Cast(stack_trace_string)->Length() > 0) {
v8::String::Utf8Value stack_trace(stack_trace_string);
const char* stack_trace_string = ToCString(stack_trace);
fprintf(stderr, "%s\n", stack_trace_string);
}