From a12976086e6be3f767a223df0504262cff84996b Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Thu, 10 Jul 2014 22:11:44 +0200 Subject: [PATCH] Fix potential division by zero Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- dive.c | 3 +++ 1 file changed, 3 insertions(+) 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 */