diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-01-29 15:26:24 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-29 15:26:24 -0800 |
commit | 07e94c67e0be8c31daee2799676bd226b81f5a84 (patch) | |
tree | 00d16d574bb84cd8d64a4ddd75b9dc6532a9687f /qt-ui/divelogimportdialog.cpp | |
parent | cd992bd14a292ae7117b40e1c1d6d99660d2e2da (diff) | |
download | subsurface-07e94c67e0be8c31daee2799676bd226b81f5a84.tar.gz |
Make sure the index is valid
There are reports that the replace calls can cause the application to
crash. This doesn't seem to make sense, looking at the code - this change
shouldn't make any difference. But it makes it even more clear that there
shouldn't be any possible scenario in which we call replace with an index
that's out of range.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 5cda9036e..34ad36aa2 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -469,23 +469,23 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) // now set up time, depth, temperature, po2, cns, ndl, tts, stopdepth, pressure for (int i = 0; i < currColumns.count(); i++) headers.append(""); - if (CSVApps[value].time != -1 && CSVApps[value].time < currColumns.count()) + if (CSVApps[value].time > -1 && CSVApps[value].time < currColumns.count()) headers.replace(CSVApps[value].time, tr("Sample time")); - if (CSVApps[value].depth != -1 && CSVApps[value].depth < currColumns.count()) + if (CSVApps[value].depth > -1 && CSVApps[value].depth < currColumns.count()) headers.replace(CSVApps[value].depth, tr("Sample depth")); - if (CSVApps[value].temperature != -1 && CSVApps[value].temperature < currColumns.count()) + if (CSVApps[value].temperature > -1 && CSVApps[value].temperature < currColumns.count()) headers.replace(CSVApps[value].temperature, tr("Sample temperature")); - if (CSVApps[value].po2 != -1 && CSVApps[value].po2 < currColumns.count()) + if (CSVApps[value].po2 > -1 && CSVApps[value].po2 < currColumns.count()) headers.replace(CSVApps[value].po2, tr("Sample pO₂")); - if (CSVApps[value].cns != -1 && CSVApps[value].cns < currColumns.count()) + if (CSVApps[value].cns > -1 && CSVApps[value].cns < currColumns.count()) headers.replace(CSVApps[value].cns, tr("Sample CNS")); - if (CSVApps[value].ndl != -1 && CSVApps[value].ndl < currColumns.count()) + if (CSVApps[value].ndl > -1 && CSVApps[value].ndl < currColumns.count()) headers.replace(CSVApps[value].ndl, tr("Sample NDL")); - if (CSVApps[value].tts != -1 && CSVApps[value].tts < currColumns.count()) + if (CSVApps[value].tts > -1 && CSVApps[value].tts < currColumns.count()) headers.replace(CSVApps[value].tts, tr("Sample TTS")); - if (CSVApps[value].stopdepth != -1 && CSVApps[value].stopdepth < currColumns.count()) + if (CSVApps[value].stopdepth > -1 && CSVApps[value].stopdepth < currColumns.count()) headers.replace(CSVApps[value].stopdepth, tr("Sample stopdepth")); - if (CSVApps[value].pressure != -1 && CSVApps[value].pressure < currColumns.count()) + if (CSVApps[value].pressure > -1 && CSVApps[value].pressure < currColumns.count()) headers.replace(CSVApps[value].pressure, tr("Sample pressure")); } |