diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-22 07:02:17 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-22 10:57:57 -0700 |
commit | f150c3b911dc34cc3e068b36139523dc520cc9d4 (patch) | |
tree | 4a3188586edd1db4c300a8845d439a375a8f79b8 /profile.c | |
parent | 86b8d796c8c0795aa5244479358e2f4b4533b1d9 (diff) | |
download | subsurface-f150c3b911dc34cc3e068b36139523dc520cc9d4.tar.gz |
Prevent potential division by zero
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -576,9 +576,9 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer * /* Add intermediate plot entries if required */ delta = time - lasttime; - if (delta < 0) { + if (delta <= 0) { time = lasttime; - delta = 0; + delta = 1; // avoid divide by 0 } for (offset = 10; offset < delta; offset += 10) { if (lasttime + offset > maxtime) |