summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile-widget/diveprofileitem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index ca87f4ed0..849a9d3de 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -135,7 +135,8 @@ void DiveProfileItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
QModelIndex colorIndex = dataModel->index(i, DivePlotDataModel::COLOR);
pen.setBrush(QBrush(colorIndex.data(Qt::BackgroundRole).value<QColor>()));
painter->setPen(pen);
- painter->drawLine(poly[i - 1], poly[i]);
+ if (i < poly.count())
+ painter->drawLine(poly[i - 1], poly[i]);
}
painter->restore();
}