From a74aa8a7561fedf6d4e9b8ad557e04f3bc99607f Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Mon, 23 Sep 2024 13:16:43 -0500 Subject: [PATCH] prevent seg fault due to pkg failure --- CHANGELOG.rst | 1 + src/source.cc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3d2191480..07d5a32e2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,6 +22,7 @@ Since last release **Fixed:** * Schedule Decommission in ``Reactor::Tick()`` instead of Decommission (#609) +* When trades fail in Source due to packaging, send empty material instead of seg faulting (#629) **Removed:** diff --git a/src/source.cc b/src/source.cc index 4ffc3f560..7d6b0f864 100644 --- a/src/source.cc +++ b/src/source.cc @@ -175,6 +175,9 @@ void Source::GetMatlTrades( // package in it. This single packaged resource is our response response = m_pkgd[0]; shippable_trades -= 1; + } else { + // If packaging failed, respond with a zero (empty) material + response = Material::CreateUntracked(0, m->comp()); } if (outrecipe.empty() && response->comp() != it->request->target()->comp()) {