From 5a049c1e80444b34ff543ae43402fb11760c0c26 Mon Sep 17 00:00:00 2001 From: Shrijit Singh Date: Tue, 5 May 2020 22:25:26 +0530 Subject: [PATCH] Replace current cell reference with copy The cell reference becomes invalidated as the reference becomes invalid when a new cell is added to the vector Signed-off-by: Shrijit Singh --- nav2_costmap_2d/test/integration/inflation_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nav2_costmap_2d/test/integration/inflation_tests.cpp b/nav2_costmap_2d/test/integration/inflation_tests.cpp index ae3e4d6abf4..82d84cce7b8 100644 --- a/nav2_costmap_2d/test/integration/inflation_tests.cpp +++ b/nav2_costmap_2d/test/integration/inflation_tests.cpp @@ -129,7 +129,7 @@ void TestNode::validatePointInflation( bin != m.end(); ++bin) { for (unsigned int i = 0; i < bin->second.size(); ++i) { - const CellData & cell = bin->second[i]; + const CellData cell = bin->second[i]; if (!seen[cell.index_]) { seen[cell.index_] = true; unsigned int dx = (cell.x_ > cell.src_x_) ? cell.x_ - cell.src_x_ : cell.src_x_ - cell.x_;