diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-07-15 03:14:15 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-15 03:14:15 -0700 |
commit | 4eec911d3aa8060c495d35488ff0dcbf2eaa24b3 (patch) | |
tree | 457f0eca328ef4e3b61f8bcedad2e21cf4a0bf6d /dive.c | |
parent | 95dbfc22ac7508494cc5bc383b7fe804bef3a4e6 (diff) | |
download | subsurface-4eec911d3aa8060c495d35488ff0dcbf2eaa24b3.tar.gz |
Planner: even with broken plans, don't divide by 0
This fixes the crash in #623, but not the other oddities.
See #623
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2404,8 +2404,10 @@ int average_depth(struct diveplan *dive) } dp = dp->next; } - - return integral / last_time; + if (last_time) + return integral / last_time; + else + return 0; } struct picture *alloc_picture() |