mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Profile: avoid potential crash
If things go as planned, then the length of the polygon is the same as the number of rows in the model. Turns out when running Subsurface-mobile on Android that simple truth doesn't seem to be correct. Most of the time the polygon seems to have twice as many elements as the model. But a few times I ended up in here with a polygon that had fewer elements than the model. And then things crash. This simply avoids the crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
dcce7358ff
commit
9dd26a00e8
1 changed files with 2 additions and 1 deletions
|
@ -135,6 +135,7 @@ 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);
|
||||
if (i < poly.count())
|
||||
painter->drawLine(poly[i - 1], poly[i]);
|
||||
}
|
||||
painter->restore();
|
||||
|
|
Loading…
Reference in a new issue