Skip to content

Commit 24e7755

Browse files
null-check the entry in ImportBlackboardFromJSON after createEntry (#1284)
* 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 <noreply@anthropic.com> * reduce nesting of the null check (Sonar S134) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 66fb741 commit 24e7755

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/blackboard.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ void ImportBlackboardFromJSON(const nlohmann::json& json, Blackboard& blackboard
536536
blackboard.createEntry(it.key(), res->second);
537537
entry = blackboard.getEntry(it.key());
538538
}
539+
if(!entry)
540+
{
541+
continue; // a concurrent unset() removed it right after createEntry()
542+
}
539543
// Lock entry_mutex before writing to prevent data races (BUG-4 fix).
540544
std::shared_ptr<Blackboard::EntryUpdatedSignal> update_signal;
541545
{

0 commit comments

Comments
 (0)