Skip to content

Commit

Permalink
Fix null pointer in amcl on_cleanup (#2503)
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyonghao authored Aug 12, 2021
1 parent 9759fd1 commit e8d0005
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nav2_amcl/src/amcl_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,10 @@ AmclNode::on_cleanup(const rclcpp_lifecycle::State & /*state*/)
laser_scan_sub_.reset();

// Map
map_free(map_);
map_ = nullptr;
if (map_ != NULL) {
map_free(map_);
map_ = nullptr;
}
first_map_received_ = false;
free_space_indices.resize(0);

Expand Down

0 comments on commit e8d0005

Please sign in to comment.