diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-11 10:02:58 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-11 10:02:58 -0800 |
commit | 9e85d767668faec8feec51ed00ed7c5b3db90cb3 (patch) | |
tree | f51fa1a77a58c0c2704c3565ae0aa426758bcd97 | |
parent | 19e95efd6f9b7089b2db963381fe5b2fb34ae06c (diff) | |
download | subsurface-9e85d767668faec8feec51ed00ed7c5b3db90cb3.tar.gz |
GPS data: create divesite when missing for applied GPS data
Otherwise things will of course crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | subsurface-core/gpslocation.cpp | 4 |
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; } |