File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -635,9 +635,13 @@ std::vector<LoadableSampleSet> GenerateLoadableSets(
635635 std::vector<LoadableSampleSet> result;
636636 std::mt19937 qsl_rng (settings.qsl_rng_seed );
637637
638+ // Cap sample count to QSL's actual total to avoid out-of-range indices.
639+ const size_t qsl_total_count = qsl->TotalSampleCount ();
640+ const size_t effective_sample_count = std::min (total_sample_count, qsl_total_count);
641+
638642 // Generate indices for the specified sample count.
639- std::vector<QuerySampleIndex> samples (total_sample_count );
640- for (size_t i = 0 ; i < total_sample_count ; i++) {
643+ std::vector<QuerySampleIndex> samples (effective_sample_count );
644+ for (size_t i = 0 ; i < effective_sample_count ; i++) {
641645 samples[i] = static_cast <QuerySampleIndex>(i);
642646 }
643647
You can’t perform that action at this time.
0 commit comments