diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-10-19 15:29:59 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-19 14:57:02 -0400 |
commit | a422957cd6525b9753cafacfafdf1f3eef66870d (patch) | |
tree | f29ace3e6f2681c71901d061aab6035b8505629f /profile-widget | |
parent | a9b692f0c30fecf950c52099d7c0f336f88c901f (diff) | |
download | subsurface-a422957cd6525b9753cafacfafdf1f3eef66870d.tar.gz |
Use displayed_dc instead of current_dc
current_dc is a macro that determines the dive computer
based on the current dive number. When the planner is started
from an emtpy dive list, the dive number ends up being -1 and
that doesn't produce a valid dive computer. Use the divecomputer
of the displayed_dive instead. This is done via a macro that
can also be used in two other places. Without this patch, the
planner crashed when called on an empty dive list.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/diveprofileitem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp index 1cd8fae4f..4c3db45f3 100644 --- a/profile-widget/diveprofileitem.cpp +++ b/profile-widget/diveprofileitem.cpp @@ -428,7 +428,7 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem struct gasmix *gasmix = NULL; struct event *ev = NULL; int sec = dataModel->index(i, DivePlotDataModel::TIME).data().toInt(); - gasmix = get_gasmix(&displayed_dive, current_dc, sec, &ev, gasmix); + gasmix = get_gasmix(&displayed_dive, displayed_dc, sec, &ev, gasmix); int inert = 1000 - get_o2(gasmix); mypen.setBrush(QBrush(ColorScale(value, inert))); painter->setPen(mypen); |