From f150c3b911dc34cc3e068b36139523dc520cc9d4 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 22 Jun 2015 07:02:17 -0700 Subject: Prevent potential division by zero Signed-off-by: Dirk Hohndel --- profile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profile.c b/profile.c index 7296733df..8deff29b5 100644 --- a/profile.c +++ b/profile.c @@ -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) -- cgit v1.2.3-70-g09d2