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); |
} |