Skip to content

Commit

Permalink
Add extra check for stack trace context
Browse files Browse the repository at this point in the history
  • Loading branch information
psiberx committed Dec 11, 2024
1 parent c87a929 commit a944410
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/App/Scripting/StackTrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ inline Red::DynArray<StackTraceEntry> GetStackTrace(Red::Optional<int32_t> aDept
auto depth = std::max(1, std::min(128, aDepth.value));
while (depth > 0 && frame && frame->func)
{
trace.EmplaceBack(frame->context ? frame->context->GetType()->name : Red::CName(),
frame->func->fullName,
Red::ToWeakHandle(frame->context));
Red::CName className;
if (!frame->func->flags.isStatic && frame->context && frame->context->ref.instance)
{
className = frame->context->GetType()->name;
}

trace.EmplaceBack(className, frame->func->fullName, Red::AsWeakHandle(frame->context));

frame = frame->parent;
--depth;
Expand Down

0 comments on commit a944410

Please sign in to comment.