Skip to content

Commit 08ed1d6

Browse files
committed
Fix else braces rule issue
Signed-off-by: Vignesh T <[email protected]>
1 parent 049ed8f commit 08ed1d6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nav2_map_server/src/map_io.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ void loadMapFromFile(
259259
// Handle different map modes with if else condition
260260
// Trinary and Scale modes are handled together
261261
// because they share a lot of code
262+
// Raw mode is handled separately in else if block
262263
if (load_parameters.mode == MapMode::Trinary || load_parameters.mode == MapMode::Scale) {
263264
// Convert grayscale to float in range [0.0, 1.0]
264265
Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic,
@@ -313,9 +314,7 @@ void loadMapFromFile(
313314
Eigen::Matrix<int8_t, Eigen::Dynamic, Eigen::Dynamic,
314315
Eigen::RowMajor> flipped = result.colwise().reverse();
315316
std::memcpy(msg.data.data(), flipped.data(), width * height);
316-
}
317-
// Raw mode is handled separately in else if block
318-
else if (load_parameters.mode == MapMode::Raw) {
317+
} else if (load_parameters.mode == MapMode::Raw) {
319318
// Raw mode: interpret raw image pixel values directly as occupancy values
320319
Eigen::Matrix<int8_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> result =
321320
gray_matrix.cast<int8_t>();
@@ -330,9 +329,8 @@ void loadMapFromFile(
330329
Eigen::Matrix<int8_t, Eigen::Dynamic, Eigen::Dynamic,
331330
Eigen::RowMajor> flipped = result.colwise().reverse();
332331
std::memcpy(msg.data.data(), flipped.data(), width * height);
333-
}
334-
// If the map mode is not recognized, throw an error
335-
else {
332+
} else {
333+
// If the map mode is not recognized, throw an error
336334
throw std::runtime_error("Invalid map mode");
337335
}
338336

0 commit comments

Comments
 (0)