mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Don't acces null dive computer
Fixes CID 350111 Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
143da031ce
commit
dbb504429d
1 changed files with 4 additions and 2 deletions
|
@ -246,9 +246,11 @@ void add_extra_data(struct divecomputer *dc, const char *key, const char *value)
|
|||
enum divemode_t get_current_divemode(const struct divecomputer *dc, int time, const struct event **evp, enum divemode_t *divemode)
|
||||
{
|
||||
const struct event *ev = *evp;
|
||||
if (*divemode == UNDEF_COMP_TYPE) {
|
||||
if (*divemode == UNDEF_COMP_TYPE && dc) {
|
||||
*divemode = dc->divemode;
|
||||
ev = dc ? get_next_event(dc->events, "modechange") : NULL;
|
||||
ev = get_next_event(dc->events, "modechange");
|
||||
} else {
|
||||
ev = NULL;
|
||||
}
|
||||
while (ev && ev->time.seconds < time) {
|
||||
*divemode = (enum divemode_t) ev->value;
|
||||
|
|
Loading…
Reference in a new issue