From fb258f067168c43dfb0b1edd6748d631e3bceef8 Mon Sep 17 00:00:00 2001 From: Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> Date: Sun, 27 Aug 2023 20:54:34 -0400 Subject: [PATCH] Handle empty addr2line input --- src/symbols/symbols_with_addr2line.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/symbols/symbols_with_addr2line.cpp b/src/symbols/symbols_with_addr2line.cpp index 7647d9d..7135692 100644 --- a/src/symbols/symbols_with_addr2line.cpp +++ b/src/symbols/symbols_with_addr2line.cpp @@ -425,6 +425,13 @@ namespace cpptrace { for(const auto& entry : entries) { const auto& object_name = entry.first; const auto& entries_vec = entry.second; + // You may ask why it'd ever happen that there could be an empty entries_vec array, if there're + // no addresses why would get_addr2line_targets do anything? The reason is because if things in + // get_addr2line_targets fail it will silently skip. This is partly an optimization but also an + // assertion below will fail if addr2line is given an empty input. + if(entries_vec.empty()) { + continue; + } std::string address_input; for(const auto& pair : entries_vec) { address_input += pair.first;