From db6f96b5aea95d5c927272c63d8e35b266636b95 Mon Sep 17 00:00:00 2001 From: Eric Davies Date: Mon, 19 Dec 2016 15:19:40 -0600 Subject: [PATCH 1/2] Fix #19655 --- base/stacktraces.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/stacktraces.jl b/base/stacktraces.jl index 7f92db5995b0b..ca54c3c345c6c 100644 --- a/base/stacktraces.jl +++ b/base/stacktraces.jl @@ -144,7 +144,7 @@ doesn't return C functions, but this can be enabled.) When called without specif trace, `stacktrace` first calls `backtrace`. """ function stacktrace(trace::Vector{Ptr{Void}}, c_funcs::Bool=false) - stack = vcat(map(lookup, trace)...)::StackTrace + stack = vcat(StackTrace(), map(lookup, trace)...)::StackTrace # Remove frames that come from C calls. if !c_funcs From 7a8d0f29becc1a8e107f3b9f549fb6505a8b2239 Mon Sep 17 00:00:00 2001 From: Eric Davies Date: Tue, 3 Jan 2017 14:20:33 -0600 Subject: [PATCH 2/2] Test for #19655 --- test/stacktraces.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/stacktraces.jl b/test/stacktraces.jl index 8f2400662f0f0..35206bd04f5d2 100644 --- a/test/stacktraces.jl +++ b/test/stacktraces.jl @@ -124,3 +124,12 @@ let ctestptr = cglobal((:ctest, "libccalltest")), @test ctest[1].from_c @test ctest[1].pointer === UInt64(ctestptr) end + +# #19655 +let + # not in a `catch`, so should return an empty StackTrace + st = stacktrace(empty!(backtrace())) + + @test isempty(st) + @test isa(st, StackTrace) +end