diff options
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -2951,9 +2951,13 @@ 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 (ds && !dive_site_has_gps_location(ds) && (pic->latitude.udeg || pic->longitude.udeg)) { - ds->latitude = pic->latitude; - ds->longitude = pic->longitude; + if (!dive_site_has_gps_location(ds) && (pic->latitude.udeg || pic->longitude.udeg)) { + if (ds) { + ds->latitude = pic->latitude; + ds->longitude = pic->longitude; + } else { + d->dive_site_uuid = create_dive_site_with_gps("", pic->latitude, pic->longitude); + } } } |