diff --git a/src/blackmisc/aviation/altitude.cpp b/src/blackmisc/aviation/altitude.cpp index 82ef5db4f..6c9788375 100644 --- a/src/blackmisc/aviation/altitude.cpp +++ b/src/blackmisc/aviation/altitude.cpp @@ -88,16 +88,18 @@ namespace BlackMisc } } - void CAltitude::toFlightLevel() + bool CAltitude::toFlightLevel() { - Q_ASSERT(m_datum == MeanSeaLevel || m_datum == FlightLevel); + if (m_datum != MeanSeaLevel && m_datum != FlightLevel) { return false; } m_datum = FlightLevel; + return true; } - void CAltitude::toMeanSeaLevel() + bool CAltitude::toMeanSeaLevel() { - Q_ASSERT(m_datum == MeanSeaLevel || m_datum == FlightLevel); + if (m_datum != MeanSeaLevel && m_datum != FlightLevel) { return false; } m_datum = MeanSeaLevel; + return true; } void CAltitude::convertToPressureAltitude(const CPressure &seaLevelPressure) @@ -173,7 +175,7 @@ namespace BlackMisc { QString v(value.trimmed()); this->setNull(); - if (v.isEmpty() || v.length() < 3) + if (v.length() < 3) { if (msgs) { msgs->push_back(CStatusMessage(this).validationError("Altitude empty or too short")); } return false; diff --git a/src/blackmisc/aviation/altitude.h b/src/blackmisc/aviation/altitude.h index ea18edd52..9b3d01b15 100644 --- a/src/blackmisc/aviation/altitude.h +++ b/src/blackmisc/aviation/altitude.h @@ -133,10 +133,10 @@ namespace BlackMisc ReferenceDatum getReferenceDatum() const { return m_datum; } //! MSL to flightlevel - void toFlightLevel(); + bool toFlightLevel(); //! Flightlevel to MSL - void toMeanSeaLevel(); + bool toMeanSeaLevel(); //! Current altitude type AltitudeType getAltitudeType() const { return m_altitudeType; }