diff --git a/src/nasal_vm.cpp b/src/nasal_vm.cpp index 693a0be..6ad00f8 100644 --- a/src/nasal_vm.cpp +++ b/src/nasal_vm.cpp @@ -263,6 +263,11 @@ void vm::function_call_trace() { std::clog << " at " << files[bytecode[ctx.pc].fidx] << ":"; std::clog << bytecode[ctx.pc].line << "\n"; + if (callsite.empty()) { + cp.restore_code_page(); + return; + } + const nas_func* prev = nullptr; u64 prev_addr = 0; u64 same_call_count = 0; diff --git a/test/backtrace/empty_callsite.nas b/test/backtrace/empty_callsite.nas new file mode 100644 index 0000000..5debe84 --- /dev/null +++ b/test/backtrace/empty_callsite.nas @@ -0,0 +1,3 @@ +use std.math; + +math.clamp(); \ No newline at end of file