From 8e3539159c2eb5d762211cf3bd5494d6983c3cbc Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 29 Jun 2016 16:25:42 +0100 Subject: [PATCH] Fix an assert on Windows --- src/GUI/AircraftModel.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/GUI/AircraftModel.cxx b/src/GUI/AircraftModel.cxx index 1bc27cb88..b0369b7eb 100644 --- a/src/GUI/AircraftModel.cxx +++ b/src/GUI/AircraftModel.cxx @@ -503,16 +503,18 @@ QModelIndex AircraftItemModel::officialHangarMessageIndex() const void AircraftItemModel::scanDirs() { - abandonCurrentScan(); - - int firstRow = (m_showOfficialHangarMessage ? 1 : 0); - int numToRemove = m_items.size() - firstRow; - int lastRow = firstRow + numToRemove - 1; - - beginRemoveRows(QModelIndex(), firstRow, lastRow); - m_items.remove(firstRow, numToRemove); - m_activeVariant.remove(firstRow, numToRemove); - endRemoveRows(); + abandonCurrentScan(); + + int firstRow = (m_showOfficialHangarMessage ? 1 : 0); + int numToRemove = m_items.size() - firstRow; + if (numToRemove > 0) { + int lastRow = firstRow + numToRemove - 1; + + beginRemoveRows(QModelIndex(), firstRow, lastRow); + m_items.remove(firstRow, numToRemove); + m_activeVariant.remove(firstRow, numToRemove); + endRemoveRows(); + } QStringList dirs = m_paths; -- 2.39.5