Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed RViz crash if flat height layer is invalid #384

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions grid_map_rviz_plugin/src/GridMapVisual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void GridMapVisual::computeVisualization(float alpha, bool showGridLines, bool f
}
const double resolution = map_.getResolution();
const grid_map::Matrix& heightData = map_[flatTerrain ? layerNames[0] : heightLayer];
const grid_map::Matrix& colorData = map_[flatColor ? layerNames[0] : colorLayer];
const grid_map::Matrix& colorData = map_[(flatColor || noColor) ? layerNames[0] : colorLayer];

// Reset and begin the manualObject (mesh).
// For more information: https://www.ogre3d.org/docs/api/1.7/class_ogre_1_1_manual_object.html#details
Expand All @@ -103,7 +103,7 @@ void GridMapVisual::computeVisualization(float alpha, bool showGridLines, bool f

// Compute a mask of valid cells.
auto basicLayers = map_.getBasicLayers();
if (std::find(basicLayers.begin(), basicLayers.end(), heightLayer) == basicLayers.end()) {
if (!flatTerrain && std::find(basicLayers.begin(), basicLayers.end(), heightLayer) == basicLayers.end()) {
basicLayers.emplace_back(heightLayer);
}
const MaskArray isValid = computeIsValidMask(basicLayers);
Expand Down