summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-03-02 15:14:55 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-16 12:42:29 -0700
commite5e2be92bc43efe178110393fb77e302def8729d (patch)
tree842b751acf5bb2639fc3e57db1de25a54ba2ff2c /dive.c
parentd45c2da81d661232fd92ee91a674fc9bc05b3b41 (diff)
downloadsubsurface-e5e2be92bc43efe178110393fb77e302def8729d.tar.gz
When loading an image with geodata create a divesite when the dive has none.
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/dive.c b/dive.c
index ce682bc1f..4afb21f37 100644
--- a/dive.c
+++ b/dive.c
@@ -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);
+ }
}
}