diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-06 23:00:17 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-07 08:16:53 -0700 |
commit | 1b0812a8cb70a767b029daf82d9251fa7dcc0afb (patch) | |
tree | cd208533e266153f2cd0c55603a8525dbdb42a8d | |
parent | 3278953f861c193c9270707f8cf222c4439d9fa2 (diff) | |
download | subsurface-1b0812a8cb70a767b029daf82d9251fa7dcc0afb.tar.gz |
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>
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 016cbf947..4ca872192 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -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)) { |