summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-26 11:42:55 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-26 11:43:56 -0800
commit30b25d1212517532db91903828579ab4cb63b06c (patch)
tree54b0303fa1a3c4ccf9774fb4705981754b2187d7 /qt-ui
parent6801c68c2dfa68436a7d8a65c4baea157decf3f2 (diff)
downloadsubsurface-30b25d1212517532db91903828579ab4cb63b06c.tar.gz
New profile: create fake DC if we have no samples
This call got lost when creating the new plot_info structures. dives/test15.xml is a good test case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/profilewidget2.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index dda97c6e0..3cb9fb20f 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -11,6 +11,7 @@
#include "divetooltipitem.h"
#include "animationfunctions.h"
#include "planner.h"
+#include "device.h"
#include <QSignalTransition>
#include <QPropertyAnimation>
#include <QMenu>
@@ -315,12 +316,15 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
return;
setProfileState();
- // Here we need to probe for the limits of the dive.
- // There's already a function that does exactly that,
- // but it's using the graphics context, and I need to
- // replace that.
+
+ // next get the dive computer structure - if there are no samples
+ // let's create a fake profile that's somewhat reasonable for the
+ // data that we have
struct divecomputer *currentdc = select_dc(&d->dc);
Q_ASSERT(currentdc);
+ if (!currentdc || !currentdc->samples) {
+ currentdc = fake_dc(currentdc);
+ }
/* This struct holds all the data that's about to be plotted.
* I'm not sure this is the best approach ( but since we are