mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Profile2: Prevent a crash if no dives are present
But in general we should not show the profile of a dive that was recently removed from the list - e.g. via File->Close. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
50424df653
commit
0dfff310de
1 changed files with 2 additions and 0 deletions
|
|
@ -378,6 +378,8 @@ void DiveGasPressureItem::paint(QPainter* painter, const QStyleOptionGraphicsIte
|
||||||
pen.setCosmetic(true);
|
pen.setCosmetic(true);
|
||||||
pen.setWidth(2);
|
pen.setWidth(2);
|
||||||
struct dive *d = getDiveById(dataModel->id());
|
struct dive *d = getDiveById(dataModel->id());
|
||||||
|
if (!d)
|
||||||
|
return;
|
||||||
struct plot_data *entry = dataModel->data().entry;
|
struct plot_data *entry = dataModel->data().entry;
|
||||||
Q_FOREACH(const QPolygonF& poly, polygons) {
|
Q_FOREACH(const QPolygonF& poly, polygons) {
|
||||||
for (int i = 1, count = poly.count(); i < count; i++, entry++) {
|
for (int i = 1, count = poly.count(); i < count; i++, entry++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue