Skip to content

Commit ea90f46

Browse files
zouyonghaoSteveMacenski
authored andcommitted
Fix null pointer in amcl on_cleanup (#2503)
1 parent 826b0d0 commit ea90f46

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎nav2_amcl/src/amcl_node.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ AmclNode::on_cleanup(const rclcpp_lifecycle::State & /*state*/)
335335
laser_scan_sub_.reset();
336336

337337
// Map
338-
map_free(map_);
339-
map_ = nullptr;
338+
if (map_ != NULL) {
339+
map_free(map_);
340+
map_ = nullptr;
341+
}
340342
first_map_received_ = false;
341343
free_space_indices.resize(0);
342344

0 commit comments

Comments
 (0)