From 6354f973211f055693c799938b83ceb6f16a4616 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 13 Mar 2022 15:33:04 -0700 Subject: [PATCH] fix merge problem I guess I get what I deserve. Signed-off-by: Dirk Hohndel --- commands/command_edit.cpp | 3 ++- qt-models/cylindermodel.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 6adfdf945..51967a405 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -1362,8 +1362,9 @@ void EditCylinder::undo() } EditSensors::EditSensors(int toCylinderIn, int fromCylinderIn) - : dc(current_dc), d(current_dive), toCylinder(toCylinderIn), fromCylinder(fromCylinderIn) + : d(current_dive), toCylinder(toCylinderIn), fromCylinder(fromCylinderIn) { + const struct divecomputer *dc = get_dive_dc(d, dc_number); if (!d || !dc) return; diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 580dd2dd4..bc8d3e7a3 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -241,8 +241,9 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const return static_cast(cyl->type.size.mliter); case SENSORS: { std::vector sensors; - for (int i = 0; i < current_dc->samples; ++i) { - auto &sample = current_dc->sample[i]; + const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number); + for (int i = 0; i < currentdc->samples; ++i) { + auto &sample = currentdc->sample[i]; for (auto s = 0; s < MAX_SENSORS; ++s) { if (sample.pressure[s].mbar) { if (sample.sensor[s] == index.row()) @@ -553,8 +554,9 @@ Qt::ItemFlags CylindersModel::flags(const QModelIndex &index) const if (index.column() == REMOVE || index.column() == USE) return Qt::ItemIsEnabled; if (index.column() == SENSORS) { - for (int i = 0; i < current_dc->samples; ++i) { - auto &sample = current_dc->sample[i]; + const struct divecomputer *currentdc = get_dive_dc(current_dive, dc_number); + for (int i = 0; i < currentdc->samples; ++i) { + auto &sample = currentdc->sample[i]; for (auto s = 0; s < MAX_SENSORS; ++s) { if (sample.pressure[s].mbar) { if (sample.sensor[s] == index.row())