aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-08 16:47:06 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-08 16:47:06 -0800
commit9ee0bfe63375a89f8c4e3a9a9e8c1a4476b38e2e (patch)
tree3c6a65bd5c9b6de6d8a0b31f155362641482f6f0
parent989c8f011011aaa2167a7c04ad309030d282e1da (diff)
downloadsubsurface-9ee0bfe63375a89f8c4e3a9a9e8c1a4476b38e2e.tar.gz
Don't use dive before checking it against NULL
Dive gets dereferenced in get_surface_pressure_in_mbar(). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--divelist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/divelist.c b/divelist.c
index 2d8918784..229ea19c8 100644
--- a/divelist.c
+++ b/divelist.c
@@ -388,10 +388,11 @@ double init_decompression(struct dive *dive)
timestamp_t when, lasttime = 0;
bool deco_init = false;
double tissue_tolerance, surface_pressure;
- tissue_tolerance = surface_pressure = get_surface_pressure_in_mbar(dive, true) / 1000.0;
if (!dive)
return 0.0;
+
+ tissue_tolerance = surface_pressure = get_surface_pressure_in_mbar(dive, true) / 1000.0;
divenr = get_divenr(dive);
when = dive->when;
i = divenr;