Fix access violation in create_schematic() (#11534)

fixes #11533

Schematics saved from y locations greater than 0 would cause an access violation if layer probabilities were specified
master
Treer 2021-08-17 01:55:35 +10:00 committed by GitHub
parent b3b075ea02
commit 963fbd1572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -598,8 +598,9 @@ void Schematic::applyProbabilities(v3s16 p0,
}
for (size_t i = 0; i != splist->size(); i++) {
s16 y = (*splist)[i].first - p0.Y;
slice_probs[y] = (*splist)[i].second;
s16 slice = (*splist)[i].first;
if (slice < size.Y)
slice_probs[slice] = (*splist)[i].second;
}
}