diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-06-03 07:48:35 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-03 07:50:04 -0700 |
commit | 7651de361a9045f734ced6f790d44b85c2c91cb9 (patch) | |
tree | d51257309ad4a7528d517c5219be63a3f9188f73 /dive.h | |
parent | 575a092e7e87d7c86a3eabf89eb9fd68376b92b6 (diff) | |
download | subsurface-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.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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(); |