File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -393,8 +393,7 @@ bool rmw_context_impl_s::create_node_data(
393
393
const std::string & node_name)
394
394
{
395
395
std::lock_guard<std::recursive_mutex> lock (data_->mutex_ );
396
- auto node_insertion = data_->nodes_ .insert (std::make_pair (node, nullptr ));
397
- if (!node_insertion.second ) {
396
+ if (data_->nodes_ .count (node) > 0 ) {
398
397
// Node already exists.
399
398
return false ;
400
399
}
@@ -419,7 +418,10 @@ bool rmw_context_impl_s::create_node_data(
419
418
return false ;
420
419
}
421
420
422
- node_insertion.first ->second = std::move (node_data);
421
+ auto node_insertion = data_->nodes_ .insert (std::make_pair (node, std::move (node_data)));
422
+ if (!node_insertion.second ) {
423
+ return false ;
424
+ }
423
425
424
426
return true ;
425
427
}
You can’t perform that action at this time.
0 commit comments