Skip to content

Commit aa0c633

Browse files
fix(ndt_scan_matcher): avoid passing nullptr in ndt (#6620)
Avoid passing nullptr in ndt Signed-off-by: Shintaro SAKODA <shintaro.sakoda@tier4.jp>
1 parent 7f36c52 commit aa0c633

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

localization/ndt_scan_matcher/src/map_update_module.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
8888
ndt_ptr_mutex_->unlock();
8989
return;
9090
}
91-
ndt_ptr_->setInputSource(input_source);
91+
if (input_source != nullptr) {
92+
ndt_ptr_->setInputSource(input_source);
93+
}
9294
ndt_ptr_mutex_->unlock();
9395
need_rebuild_ = false;
9496
} else {
@@ -107,7 +109,9 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
107109
auto dummy_ptr = ndt_ptr_;
108110
auto input_source = ndt_ptr_->getInputSource();
109111
ndt_ptr_ = secondary_ndt_ptr_;
110-
ndt_ptr_->setInputSource(input_source);
112+
if (input_source != nullptr) {
113+
ndt_ptr_->setInputSource(input_source);
114+
}
111115
ndt_ptr_mutex_->unlock();
112116

113117
dummy_ptr.reset();

0 commit comments

Comments
 (0)