summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 07:48:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 07:50:04 -0700
commit7651de361a9045f734ced6f790d44b85c2c91cb9 (patch)
treed51257309ad4a7528d517c5219be63a3f9188f73 /dive.h
parent575a092e7e87d7c86a3eabf89eb9fd68376b92b6 (diff)
downloadsubsurface-7651de361a9045f734ced6f790d44b85c2c91cb9.tar.gz
Don't crash when looping over pictures for a null dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/dive.h b/dive.h
index 0ff22e607..737278181 100644
--- a/dive.h
+++ b/dive.h
@@ -291,8 +291,9 @@ struct picture {
struct picture *next;
};
-#define FOR_EACH_PICTURE( DIVE ) \
- for(struct picture *picture = DIVE->picture_list; picture; picture = picture->next)
+#define FOR_EACH_PICTURE(_dive) \
+ if (_dive) \
+ for (struct picture *picture = (_dive)->picture_list; picture; picture = picture->next)
extern struct picture *alloc_picture();