mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Prevent segfault for dive with gas change but no samples
Not quite sure where such a dive would come from, but anyway, just don't dereference the pointer unless it's non-NULL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6ce0afb99c
commit
9eb55a0fc6
1 changed files with 1 additions and 1 deletions
2
dive.c
2
dive.c
|
@ -789,7 +789,7 @@ static int same_rounded_pressure(pressure_t a, pressure_t b)
|
|||
int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc)
|
||||
{
|
||||
struct event *ev = get_next_event(dc->events, "gaschange");
|
||||
if (ev && ev->time.seconds == dc->sample[0].time.seconds)
|
||||
if (ev && dc && dc->sample && ev->time.seconds == dc->sample[0].time.seconds)
|
||||
return get_cylinder_index(dive, ev);
|
||||
else
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue