mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:13:24 +00:00
Prevent potential division by zero
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
86b8d796c8
commit
f150c3b911
1 changed files with 2 additions and 2 deletions
|
@ -576,9 +576,9 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
||||||
|
|
||||||
/* Add intermediate plot entries if required */
|
/* Add intermediate plot entries if required */
|
||||||
delta = time - lasttime;
|
delta = time - lasttime;
|
||||||
if (delta < 0) {
|
if (delta <= 0) {
|
||||||
time = lasttime;
|
time = lasttime;
|
||||||
delta = 0;
|
delta = 1; // avoid divide by 0
|
||||||
}
|
}
|
||||||
for (offset = 10; offset < delta; offset += 10) {
|
for (offset = 10; offset < delta; offset += 10) {
|
||||||
if (lasttime + offset > maxtime)
|
if (lasttime + offset > maxtime)
|
||||||
|
|
Loading…
Add table
Reference in a new issue