mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Cleanup: prevent NULL dereference
This should never happen based on the logic in the callers, but just to be on the safe side. Should fix CID 350128 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b0a00cd15d
commit
1951371bbb
1 changed files with 1 additions and 1 deletions
|
@ -1471,7 +1471,7 @@ static int comp_dive_to_trip(struct dive *a, struct dive_trip *b)
|
|||
{
|
||||
/* This should never happen, nevertheless don't crash on trips
|
||||
* with no (or worse a negative number of) dives. */
|
||||
if (b->dives.nr <= 0)
|
||||
if (!b || b->dives.nr <= 0)
|
||||
return -1;
|
||||
return comp_dives(a, b->dives.dives[0]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue