From 9e85d767668faec8feec51ed00ed7c5b3db90cb3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 11 Jan 2016 10:02:58 -0800 Subject: GPS data: create divesite when missing for applied GPS data Otherwise things will of course crash. Signed-off-by: Dirk Hohndel --- subsurface-core/gpslocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- cgit v1.2.3-70-g09d2