From ad4b02998412749788e4526bb1eb1b43a6bfcf39 Mon Sep 17 00:00:00 2001 From: Christopher Barber Date: Wed, 13 Nov 2024 17:53:29 -0500 Subject: [PATCH] Fix for segfault #520 --- .../src/explanation_based_chunking/ebc_repair.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Core/SoarKernel/src/explanation_based_chunking/ebc_repair.cpp b/Core/SoarKernel/src/explanation_based_chunking/ebc_repair.cpp index 3c69441ede..fa79b96efe 100644 --- a/Core/SoarKernel/src/explanation_based_chunking/ebc_repair.cpp +++ b/Core/SoarKernel/src/explanation_based_chunking/ebc_repair.cpp @@ -150,14 +150,16 @@ void Repair_Manager::add_state_link_WMEs(goal_stack_level pTargetGoal, tc_number void Repair_Manager::add_path_to_goal_WMEs(chunk_element* pTargetSym, tc_number cond_tc) { wme_list* l_WMEPath = find_path_to_goal_for_symbol(pTargetSym->instantiated_sym); - for (auto it = l_WMEPath->begin(); it != l_WMEPath->end(); it++) - { - wme* lWME = (*it); - if ((lWME->tc == cond_tc) && (lWME->value != pTargetSym->instantiated_sym)) + if (l_WMEPath) { + for (auto it = l_WMEPath->begin(); it != l_WMEPath->end(); it++) { - continue; + wme* lWME = (*it); + if ((lWME->tc == cond_tc) && (lWME->value != pTargetSym->instantiated_sym)) + { + continue; + } + m_repair_WMEs.insert(lWME); } - m_repair_WMEs.insert(lWME); } }