summaryrefslogtreecommitdiffstats
path: root/subsurface-core/gpslocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'subsurface-core/gpslocation.cpp')
-rw-r--r--subsurface-core/gpslocation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/subsurface-core/gpslocation.cpp b/subsurface-core/gpslocation.cpp
index f1aa3a85d..08c47165d 100644
--- a/subsurface-core/gpslocation.cpp
+++ b/subsurface-core/gpslocation.cpp
@@ -203,6 +203,10 @@ int GpsLocation::getGpsNum() const
static void copy_gps_location(struct gpsTracker &gps, struct dive *d)
{
struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid);
+ if (!ds) {
+ d->dive_site_uuid = create_dive_site(qPrintable(gps.name), gps.when);
+ ds = get_dive_site_by_uuid(d->dive_site_uuid);
+ }
ds->latitude = gps.latitude;
ds->longitude = gps.longitude;
}