diff --git a/src/execution/messages.cc b/src/execution/messages.cc index 122687b3fd54..21321a4155e8 100644 --- a/src/execution/messages.cc +++ b/src/execution/messages.cc @@ -305,7 +305,8 @@ MaybeHandle ErrorUtils::FormatStackTrace(Isolate* isolate, const bool in_recursion = isolate->formatting_stack_trace(); const bool has_overflowed = i::StackLimitCheck{isolate}.HasOverflowed(); Handle error_context; - if (!in_recursion && error->GetCreationContext().ToHandle(&error_context)) { + if (!in_recursion && !has_overflowed && + error->GetCreationContext().ToHandle(&error_context)) { DCHECK(error_context->IsNativeContext()); if (isolate->HasPrepareStackTraceCallback()) { @@ -321,7 +322,7 @@ MaybeHandle ErrorUtils::FormatStackTrace(Isolate* isolate, isolate->RunPrepareStackTraceCallback(error_context, error, sites), Object); return result; - } else if (!has_overflowed) { + } else { Handle global_error = handle(error_context->error_function(), isolate);