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>
This commit is contained in:
Dirk Hohndel 2015-12-26 21:24:29 -08:00
parent ce2b910cdb
commit dce3869339

View file

@ -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())) {