Warn if we edit non-existant dive site

And try to add it to the dive - bubt we really shouldn't get here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-10-06 23:00:17 -07:00
parent 3278953f86
commit 1b0812a8cb

View file

@ -143,12 +143,13 @@ void LocationInformationWidget::acceptChanges()
char *uiString;
struct dive_site *currentDs;
uiString = ui.diveSiteName->text().toUtf8().data();
if (get_dive_site_by_uuid(displayed_dive_site.uuid) != NULL)
if (get_dive_site_by_uuid(displayed_dive_site.uuid) != NULL) {
currentDs = get_dive_site_by_uuid(displayed_dive_site.uuid);
else
} else {
qWarning() << "did not have valid dive site in LocationInformationWidget";
currentDs = get_dive_site_by_uuid(create_dive_site_from_current_dive(uiString));
displayed_dive.dive_site_uuid = currentDs->uuid;
}
currentDs->latitude = displayed_dive_site.latitude;
currentDs->longitude = displayed_dive_site.longitude;
if (!same_string(uiString, currentDs->name)) {