Skip to content

Commit edd6731

Browse files
committed
Fix #271: better error message
1 parent 9288fb2 commit edd6731

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/behaviortree_cpp/blackboard.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ class Blackboard
139139
{
140140
if (auto any_ref = getAnyLocked(key))
141141
{
142+
const auto& any = any_ref.get();
143+
if(any->empty())
144+
{
145+
throw RuntimeError("Blackboard::get() error. Entry [", key, "] hasn't been initialized, yet");
146+
}
142147
return any_ref.get()->cast<T>();
143148
}
144149
else

0 commit comments

Comments
 (0)