diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-12-26 21:24:29 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-12-26 21:24:29 -0800 |
commit | dce3869339563c31e6c6fdf267e803eca4d134ea (patch) | |
tree | d1bc5d7ea3db9586c9f0e95128c56706a20e00ac /qt-mobile/qmlmanager.cpp | |
parent | ce2b910cdbd79547ab78ad65fb95f10fa19ea9dd (diff) | |
download | subsurface-dce3869339563c31e6c6fdf267e803eca4d134ea.tar.gz |
QML UI: don't crash when committing changes and unable to find the dive
This mainly happens because add dive is completely broken right now, but in
general it seems to be good policy not to blindly dereference this pointer...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index e684255c3..3a62fb342 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -279,6 +279,12 @@ void QMLManager::loadDivesWithValidCredentials() void QMLManager::commitChanges(QString diveId, QString suit, QString buddy, QString diveMaster, QString notes) { struct dive *d = get_dive_by_uniq_id(diveId.toInt()); + qDebug() << diveId.toInt() << (d != 0 ? d->number : -1); + + if (!d) { + qDebug() << "don't touch this... no dive"; + return; + } bool diveChanged = false; if (!same_string(d->suit, suit.toUtf8().data())) { |