summaryrefslogtreecommitdiffstats
path: root/qt-models/diveplannermodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/diveplannermodel.cpp')
-rw-r--r--qt-models/diveplannermodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 614f194aa..9af6833f0 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -346,8 +346,10 @@ void DivePlannerPointsModel::gasChange(const QModelIndex &index, int newcylinder
void DivePlannerPointsModel::cylinderRenumber(int mapping[])
{
- for (int i = 0; i < rowCount(); i++)
- divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
+ for (int i = 0; i < rowCount(); i++) {
+ if (mapping[divepoints[i].cylinderid] >= 0)
+ divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
+ }
emitDataChanged();
}