summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Jan Darowski <jan.darowski@gmail.com>2015-03-16 19:48:55 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-16 12:19:23 -0700
commitd45c2da81d661232fd92ee91a674fc9bc05b3b41 (patch)
tree1dbba9b98a7059a03f1e7d9609674fdd48eac21e /dive.c
parentf724b7ebf98904a436ab1a9a616ee720b19a54c2 (diff)
downloadsubsurface-d45c2da81d661232fd92ee91a674fc9bc05b3b41.tar.gz
Fixed dive_set_geodata_from_picture segfault.
Segfault did appear when picture had some gps coordinates but there was no dive site assigned to the dive. Signed-off-by: Jan Darowski <jan.darowski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dive.c b/dive.c
index afa38e471..ce682bc1f 100644
--- a/dive.c
+++ b/dive.c
@@ -2951,7 +2951,7 @@ unsigned int dive_get_picture_count(struct dive *d)
void dive_set_geodata_from_picture(struct dive *d, struct picture *pic)
{
struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid);
- if (!dive_site_has_gps_location(ds) && (pic->latitude.udeg || pic->longitude.udeg)) {
+ if (ds && !dive_site_has_gps_location(ds) && (pic->latitude.udeg || pic->longitude.udeg)) {
ds->latitude = pic->latitude;
ds->longitude = pic->longitude;
}