diff options
-rw-r--r-- | qt-ui/maintab.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 5dcd09062..d753379c7 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -559,9 +559,14 @@ void MainTab::rejectChanges() mydive->weightsystem[i] = notesBackup[mydive].weightsystem[i]; } } - multiEditEquipmentPlaceholder = *get_dive(selected_dive); - cylindersModel->setDive(&multiEditEquipmentPlaceholder); - weightModel->setDive(&multiEditEquipmentPlaceholder); + if (selected_dive > 0) { + multiEditEquipmentPlaceholder = *get_dive(selected_dive); + cylindersModel->setDive(&multiEditEquipmentPlaceholder); + weightModel->setDive(&multiEditEquipmentPlaceholder); + } else { + cylindersModel->clear(); + weightModel->clear(); + } } ui.diveNotesMessage->animatedHide(); |