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>
This commit is contained in:
Robert C. Helling 2019-11-15 09:57:17 +01:00 committed by Dirk Hohndel
parent 1a2c42cebc
commit 28db9ede41

View file

@ -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;