mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: fix potential uninitialized use of uuid
And make sure we don't create a dive site for an empty location string. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bd66ab15da
commit
648fec7a3d
1 changed files with 4 additions and 5 deletions
|
@ -814,15 +814,14 @@ parsed:
|
||||||
bool QMLManager::checkLocation(DiveObjectHelper *myDive, struct dive *d, QString location, QString gps)
|
bool QMLManager::checkLocation(DiveObjectHelper *myDive, struct dive *d, QString location, QString gps)
|
||||||
{
|
{
|
||||||
bool diveChanged = false;
|
bool diveChanged = false;
|
||||||
uint32_t uuid;
|
uint32_t uuid = 0;
|
||||||
struct dive_site *ds = get_dive_site_for_dive(d);
|
struct dive_site *ds = get_dive_site_for_dive(d);
|
||||||
if (myDive->location() != location) {
|
if (myDive->location() != location) {
|
||||||
diveChanged = true;
|
diveChanged = true;
|
||||||
if (!ds) {
|
if (!ds)
|
||||||
uuid = get_dive_site_uuid_by_name(qPrintable(location), NULL);
|
uuid = get_dive_site_uuid_by_name(qPrintable(location), NULL);
|
||||||
if (!uuid)
|
if (!uuid && !location.isEmpty())
|
||||||
uuid = create_dive_site(qPrintable(location), d->when);
|
uuid = create_dive_site(qPrintable(location), d->when);
|
||||||
}
|
|
||||||
d->dive_site_uuid = uuid;
|
d->dive_site_uuid = uuid;
|
||||||
}
|
}
|
||||||
// now make sure that the GPS coordinates match - if the user changed the name but not
|
// now make sure that the GPS coordinates match - if the user changed the name but not
|
||||||
|
|
Loading…
Add table
Reference in a new issue