diff --git a/nav2_costmap_2d/plugins/voxel_layer.cpp b/nav2_costmap_2d/plugins/voxel_layer.cpp index b8e5261bc14..51e70ab9d20 100644 --- a/nav2_costmap_2d/plugins/voxel_layer.cpp +++ b/nav2_costmap_2d/plugins/voxel_layer.cpp @@ -110,6 +110,7 @@ VoxelLayer::~VoxelLayer() void VoxelLayer::matchSize() { + std::lock_guard guard(*getMutex()); ObstacleLayer::matchSize(); voxel_grid_.resize(size_x_, size_y_, size_z_); assert(voxel_grid_.sizeX() == size_x_ && voxel_grid_.sizeY() == size_y_);