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

Unified Diff: samples/shell.cc

Issue 1410333004: Fix crash in shell.cc when reporting exceptions that aren't Errors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 2 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: samples/shell.cc
diff --git a/samples/shell.cc b/samples/shell.cc
index ad2228508439f6d14283d47bbb5b9e05519a6295..b89ffdd180e9b2d49fa30e5d29f4d50334a795f8 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -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);
}
« 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