Changeset 07e94c6 in subsurface


Ignore:
Timestamp:
Jan 29, 2015, 3:26:24 PM (3 years ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
Mtest, android_test, dcDownload, foratdotde, gitMerge, gitdebug, gitpictures, ios, master, mergeKirigamiPort, pictimeshift, resolutionIndependence, spinner, testTomaz, testing, v4.4-branch, v4.5-branch
Children:
e9558d84
Parents:
cd992bd1
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-ui/divelogimportdialog.cpp

    rdee91a9 r07e94c6  
    470470                for (int i = 0; i < currColumns.count(); i++)
    471471                        headers.append("");
    472                 if (CSVApps[value].time != -1 && CSVApps[value].time < currColumns.count())
     472                if (CSVApps[value].time > -1 && CSVApps[value].time < currColumns.count())
    473473                        headers.replace(CSVApps[value].time, tr("Sample time"));
    474                 if (CSVApps[value].depth != -1 && CSVApps[value].depth < currColumns.count())
     474                if (CSVApps[value].depth > -1 && CSVApps[value].depth < currColumns.count())
    475475                        headers.replace(CSVApps[value].depth, tr("Sample depth"));
    476                 if (CSVApps[value].temperature != -1 && CSVApps[value].temperature < currColumns.count())
     476                if (CSVApps[value].temperature > -1 && CSVApps[value].temperature < currColumns.count())
    477477                        headers.replace(CSVApps[value].temperature, tr("Sample temperature"));
    478                 if (CSVApps[value].po2 != -1 && CSVApps[value].po2 < currColumns.count())
     478                if (CSVApps[value].po2 > -1 && CSVApps[value].po2 < currColumns.count())
    479479                        headers.replace(CSVApps[value].po2, tr("Sample pO₂"));
    480                 if (CSVApps[value].cns != -1 && CSVApps[value].cns < currColumns.count())
     480                if (CSVApps[value].cns > -1 && CSVApps[value].cns < currColumns.count())
    481481                        headers.replace(CSVApps[value].cns, tr("Sample CNS"));
    482                 if (CSVApps[value].ndl != -1 && CSVApps[value].ndl < currColumns.count())
     482                if (CSVApps[value].ndl > -1 && CSVApps[value].ndl < currColumns.count())
    483483                        headers.replace(CSVApps[value].ndl, tr("Sample NDL"));
    484                 if (CSVApps[value].tts != -1 && CSVApps[value].tts < currColumns.count())
     484                if (CSVApps[value].tts > -1 && CSVApps[value].tts < currColumns.count())
    485485                        headers.replace(CSVApps[value].tts, tr("Sample TTS"));
    486                 if (CSVApps[value].stopdepth != -1 && CSVApps[value].stopdepth < currColumns.count())
     486                if (CSVApps[value].stopdepth > -1 && CSVApps[value].stopdepth < currColumns.count())
    487487                        headers.replace(CSVApps[value].stopdepth, tr("Sample stopdepth"));
    488                 if (CSVApps[value].pressure != -1 && CSVApps[value].pressure < currColumns.count())
     488                if (CSVApps[value].pressure > -1 && CSVApps[value].pressure < currColumns.count())
    489489                        headers.replace(CSVApps[value].pressure, tr("Sample pressure"));
    490490        }
Note: See TracChangeset for help on using the changeset viewer.