Fix segfault in SubgraphBuilder

release/4.3a0
Fan Jiang 2019-09-07 16:10:49 -04:00
parent 4949d6988c
commit b61636e2f7
1 changed files with 2 additions and 1 deletions

View File

@ -127,7 +127,8 @@ static vector<size_t> UniqueSampler(const vector<double> &weight,
/* sampling and cache results */
vector<size_t> samples = iidSampler(localWeights, n - count);
for (const size_t &index : samples) {
const auto samplesSize = samples.size();
for (size_t index = 0; index < samplesSize; index++) {
if (touched[index] == false) {
touched[index] = true;
samples.push_back(index);