Initialize cylinder index

Otherwise it's possible for an uninitialized value to be used
in addStop which can cause crashes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-03-04 17:14:22 -08:00
parent d36f056bde
commit 798965c10d

View file

@ -94,7 +94,7 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
// average samples so we end up with a total of 100 samples. // average samples so we end up with a total of 100 samples.
int plansamples = dc->samples <= 100 ? dc->samples : 100; int plansamples = dc->samples <= 100 ? dc->samples : 100;
int j = 0; int j = 0;
int cylinderid; int cylinderid = 0;
for (int i = 0; i < plansamples - 1; i++) { for (int i = 0; i < plansamples - 1; i++) {
while (j * plansamples <= i * dc->samples) { while (j * plansamples <= i * dc->samples) {
const sample &s = dc->sample[j]; const sample &s = dc->sample[j];