diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.h b/plugins/channelrx/demodadsb/adsbdemodgui.h index 352fc926d..e6a7ac485 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.h +++ b/plugins/channelrx/demodadsb/adsbdemodgui.h @@ -378,14 +378,17 @@ public: } void removeAllAirports() { - beginRemoveRows(QModelIndex(), 0, m_airports.count()); - m_airports.clear(); - m_airportDataFreq.clear(); - m_airportDataFreqRows.clear(); - m_showFreq.clear(); - m_azimuth.clear(); - m_elevation.clear(); - endRemoveRows(); + if (m_airports.count() > 0) + { + beginRemoveRows(QModelIndex(), 0, m_airports.count() - 1); + m_airports.clear(); + m_airportDataFreq.clear(); + m_airportDataFreqRows.clear(); + m_showFreq.clear(); + m_azimuth.clear(); + m_elevation.clear(); + endRemoveRows(); + } } int rowCount(const QModelIndex &parent = QModelIndex()) const override { diff --git a/plugins/channelrx/demodvor/vordemodgui.h b/plugins/channelrx/demodvor/vordemodgui.h index 741c9a4fe..268fc963a 100644 --- a/plugins/channelrx/demodvor/vordemodgui.h +++ b/plugins/channelrx/demodvor/vordemodgui.h @@ -143,12 +143,15 @@ public: } void removeAllVORs() { - beginRemoveRows(QModelIndex(), 0, m_vors.count()); - m_vors.clear(); - m_selected.clear(); - m_radials.clear(); - m_vorGUIs.clear(); - endRemoveRows(); + if (m_vors.count() > 0) + { + beginRemoveRows(QModelIndex(), 0, m_vors.count() - 1); + m_vors.clear(); + m_selected.clear(); + m_radials.clear(); + m_vorGUIs.clear(); + endRemoveRows(); + } } QHash roleNames() const { diff --git a/plugins/feature/map/mapgui.h b/plugins/feature/map/mapgui.h index 3bc618ea3..8bc3474e5 100644 --- a/plugins/feature/map/mapgui.h +++ b/plugins/feature/map/mapgui.h @@ -351,10 +351,13 @@ public: void removeAll() { - beginRemoveRows(QModelIndex(), 0, m_items.count()); - m_items.clear(); - m_selected.clear(); - endRemoveRows(); + if (m_items.count() > 0) + { + beginRemoveRows(QModelIndex(), 0, m_items.count()); + m_items.clear(); + m_selected.clear(); + endRemoveRows(); + } } void setDisplayNames(bool displayNames) diff --git a/plugins/feature/vorlocalizer/vorlocalizergui.h b/plugins/feature/vorlocalizer/vorlocalizergui.h index 24555f527..41891a134 100644 --- a/plugins/feature/vorlocalizer/vorlocalizergui.h +++ b/plugins/feature/vorlocalizer/vorlocalizergui.h @@ -144,12 +144,15 @@ public: } void removeAllVORs() { - beginRemoveRows(QModelIndex(), 0, m_vors.count()); - m_vors.clear(); - m_selected.clear(); - m_radials.clear(); - m_vorGUIs.clear(); - endRemoveRows(); + if (m_vors.count() > 0) + { + beginRemoveRows(QModelIndex(), 0, m_vors.count() - 1); + m_vors.clear(); + m_selected.clear(); + m_radials.clear(); + m_vorGUIs.clear(); + endRemoveRows(); + } } QHash roleNames() const {