mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't crash if get_divenr is called with NULL argument
We shouldn't be doing that, but still, let's not crash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
da911993f1
commit
947d7b77df
1 changed files with 6 additions and 4 deletions
|
@ -338,6 +338,8 @@ int get_divenr(struct dive *dive)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct dive *d;
|
struct dive *d;
|
||||||
|
// tempting as it may be, don't die when called with dive=NULL
|
||||||
|
if (dive)
|
||||||
for_each_dive(i, d) {
|
for_each_dive(i, d) {
|
||||||
if (d->id == dive->id) // don't compare pointers, we could be passing in a copy of the dive
|
if (d->id == dive->id) // don't compare pointers, we could be passing in a copy of the dive
|
||||||
return i;
|
return i;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue