summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-07-10 22:11:44 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-10 13:26:30 -0700
commita12976086e6be3f767a223df0504262cff84996b (patch)
tree821fd73bba667b4b0a2c1946c27e0af810c46492 /dive.c
parentf58bc011a7c630b2eebb4c95a728c58c8ae52962 (diff)
downloadsubsurface-a12976086e6be3f767a223df0504262cff84996b.tar.gz
Fix potential division by zero
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index 683fbb836..4cb9672ed 100644
--- a/dive.c
+++ b/dive.c
@@ -2369,6 +2369,9 @@ int average_depth(struct diveplan *dive)
int last_depth = 0;
struct divedatapoint *dp = dive->dp;
+ if (!dp)
+ return 0;
+
while (dp) {
if (dp->time) {
/* Ignore gas indication samples */