Check "hasDCSalinity" is null in updateWaterTypeWidget()

Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
This commit is contained in:
Rafael M. Salvioni 2023-07-12 18:49:03 -03:00 committed by Michael Keller
parent 5511cd13d7
commit 8f8f901aa8

View file

@ -95,7 +95,7 @@ void TabDiveInformation::closeWarning()
void TabDiveInformation::updateWaterTypeWidget() void TabDiveInformation::updateWaterTypeWidget()
{ {
// Decide on whether to show the water type/salinity combobox or not // Decide on whether to show the water type/salinity combobox or not
bool hasDCSalinity = parent.currentDive->salinity != 0; bool hasDCSalinity = parent.currentDive && parent.currentDive->salinity != 0;
if (prefs.salinityEditDefault || !hasDCSalinity) { // if the preference setting has been checked or DC doesnt have salinity info if (prefs.salinityEditDefault || !hasDCSalinity) { // if the preference setting has been checked or DC doesnt have salinity info
ui->waterTypeText->setVisible(false); ui->waterTypeText->setVisible(false);
ui->waterTypeCombo->setVisible(true); // show combobox ui->waterTypeCombo->setVisible(true); // show combobox