summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/cylindermodel.cpp4
-rw-r--r--qt-models/divesummarymodel.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index 84e9b063f..f8612c48d 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -357,7 +357,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
// First, we make a shallow copy of the old cylinder. Then we modify the fields inside that copy.
// At the end, we either place an EditCylinder undo command (EquipmentTab) or copy the cylinder back (planner).
// Yes, this is not ideal, but the pragmatic thing to do for now.
- cylinder_t cyl = d->cylinders.cylinders[row];
+ cylinder_t cyl = *get_cylinder(d, row);
if (index.column() != TYPE && !changed)
return false;
@@ -467,7 +467,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
// In the planner - simply overwrite the cylinder in the dive with the modified cylinder.
// We have only made a shallow copy, therefore copy the new cylinder first.
cylinder_t copy = clone_cylinder(cyl);
- std::swap(copy, d->cylinders.cylinders[row]);
+ std::swap(copy, *get_cylinder(d, row));
free_cylinder(copy);
dataChanged(index, index);
} else {
diff --git a/qt-models/divesummarymodel.cpp b/qt-models/divesummarymodel.cpp
index d187f2b58..6ae5313e4 100644
--- a/qt-models/divesummarymodel.cpp
+++ b/qt-models/divesummarymodel.cpp
@@ -148,7 +148,7 @@ static void calculateDive(struct dive *dive, Stats &stats)
// EAN dive ?
for (int j = 0; j < dive->cylinders.nr; ++j) {
- if (dive->cylinders.cylinders[j].gasmix.o2.permille > 210) {
+ if (get_cylinder(dive, j)->gasmix.o2.permille > 210) {
stats.divesEAN++;
break;
}