summaryrefslogtreecommitdiffstats
path: root/core/profile.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-11-15 09:57:17 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-16 12:34:30 -0800
commit28db9ede41434990a0a19ca4b96ac58af3d15460 (patch)
treeded89db76ae25ce411bb2266ae244bef7c473b21 /core/profile.c
parent1a2c42cebc64ee4e691ecff4ab531ab83054cf83 (diff)
downloadsubsurface-28db9ede41434990a0a19ca4b96ac58af3d15460.tar.gz
Don't access uninitialized deco_structure
Coverty found that in the export functions, we initialize the planner deco state with NULL and then possibly later access its content. This makes sure, we don't do that. Let's see if this makes Coverty happy or I missed somehting else. Fixes CID 350736 Fixes CID 350735 Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/profile.c')
-rw-r--r--core/profile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/profile.c b/core/profile.c
index ae1bb4259..1d3453a80 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -1034,8 +1034,9 @@ void calculate_deco_information(struct deco_state *ds, const struct deco_state *
bool first_iteration = true;
int prev_deco_time = 10000000, time_deep_ceiling = 0;
- if (!in_planner()) {
+ if (!in_planner() || !planner_ds) {
ds->deco_time = 0;
+ ds->first_ceiling_pressure.mbar = 0;
} else {
ds->deco_time = planner_ds->deco_time;
ds->first_ceiling_pressure = planner_ds->first_ceiling_pressure;