Skip to content

Commit 135d96b

Browse files
committed
Resloves issue #71 by guarding against empty path lists
This is something that is done implicitly and explicitly throughout the code, and is necessary here to ensure that we don't try to draw anything after the map data is cleared on destruction of the gui.
1 parent b3e130c commit 135d96b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/rqt_rover_gui/src/MapFrame.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,10 @@ void MapFrame::paintEvent(QPaintEvent* event) {
509509
else painter.setPen(Qt::yellow);
510510

511511
pair<float,float> current_coordinate;
512-
current_coordinate = map_data->getEKFPath(rover_to_display)->back();
512+
if(! map_data->getEKFPath(rover_to_display)->empty() )
513+
{
514+
current_coordinate = map_data->getEKFPath(rover_to_display)->back();
515+
}
513516

514517
float x = map_origin_x+((current_coordinate.first-min_seen_x)/max_seen_width)*(map_width-map_origin_x);
515518
float y = map_origin_y+((current_coordinate.second-min_seen_y)/max_seen_height)*(map_height-map_origin_y);

0 commit comments

Comments
 (0)