GPS data: create divesite when missing for applied GPS data

Otherwise things will of course crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-01-11 10:02:58 -08:00
parent 19e95efd6f
commit 9e85d76766

View file

@ -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;
}