aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-13 22:08:08 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-13 22:08:08 -0800
commitb60b4ef69d1ae81ace1d4f8ccccdd13aeee01f5a (patch)
treee4f581ce83956230f55580d3bbc8dada85a65d24 /qt-ui/simplewidgets.cpp
parentda60867ae3765dce3fbbfe85682e6157f9fd5ed7 (diff)
downloadsubsurface-b60b4ef69d1ae81ace1d4f8ccccdd13aeee01f5a.tar.gz
Fix crash when adding a dive
If a dive has no dive_site_uuid we would dereference a NULL pointer and crash. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 00f749780..4f050063c 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -666,7 +666,10 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
void LocationInformationWidget::setLocationId(uint32_t uuid)
{
currentDs = get_dive_site_by_uuid(uuid);
- displayed_dive_site = *currentDs;
+ if (currentDs)
+ displayed_dive_site = *currentDs;
+ else
+ memset(&displayed_dive, 0, sizeof(displayed_dive));
ui.diveSiteName->setText(displayed_dive_site.name);
ui.diveSiteDescription->setText(displayed_dive_site.description);
ui.diveSiteNotes->setPlainText(displayed_dive_site.notes);