From 60d71529c5b1818cfc9ec4bdf6ab4041b010ad56 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Sat, 7 Nov 2026 18:10:11 +0100 Subject: [PATCH 1/2] null-check the entry in ImportBlackboardFromJSON after createEntry After createEntry() the entry was re-fetched with getEntry() and dereferenced unchecked; a concurrent Blackboard::unset() from another thread in that window returned nullptr and crashed. Skip that key instead. No test: the window is a few instructions wide, so a deterministic reproduction is not possible. The same createEntry->getEntry->deref pattern elsewhere (SetBlackboardNode, script assignment operator) is already null-checked. Co-Authored-By: Claude Opus 5.5 --- src/blackboard.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/blackboard.cpp b/src/blackboard.cpp index 13e906e9f..b0f6fd942 100644 --- a/src/blackboard.cpp +++ b/src/blackboard.cpp @@ -535,6 +535,10 @@ void ImportBlackboardFromJSON(const nlohmann::json& json, Blackboard& blackboard { blackboard.createEntry(it.key(), res->second); entry = blackboard.getEntry(it.key()); + if(!entry) + { + continue; // a concurrent unset() removed it right after createEntry() + } } // Lock entry_mutex before writing to prevent data races (BUG-4 fix). std::shared_ptr update_signal; From f77a6a281504f9e7b755424a1a18a32cf62eee43 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Sat, 7 Nov 2026 19:17:03 +0100 Subject: [PATCH 2/2] reduce nesting of the null check (Sonar S134) Co-Authored-By: Claude Opus 5.5 --- src/blackboard.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/blackboard.cpp b/src/blackboard.cpp index b0f6fd942..65bd8d92a 100644 --- a/src/blackboard.cpp +++ b/src/blackboard.cpp @@ -535,10 +535,10 @@ void ImportBlackboardFromJSON(const nlohmann::json& json, Blackboard& blackboard { blackboard.createEntry(it.key(), res->second); entry = blackboard.getEntry(it.key()); - if(!entry) - { - continue; // a concurrent unset() removed it right after createEntry() - } + } + if(!entry) + { + continue; // a concurrent unset() removed it right after createEntry() } // Lock entry_mutex before writing to prevent data races (BUG-4 fix). std::shared_ptr update_signal;