Skip to content

Commit c6af216

Browse files
authored
speculative : fix seg fault in certain cases (#12454)
1 parent 99aa304 commit c6af216

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/speculative/speculative.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ int main(int argc, char ** argv) {
331331
}
332332

333333
active_seqs.erase(s);
334-
for(int i = 0; i < n_seq_dft; i++) {
334+
for (int i = 0; i < n_seq_dft; i++) {
335335
if (i == s) {
336336
continue;
337337
}
338-
if (drafts[i].tokens[i_dft] == drafts[s].tokens[i_dft]) {
338+
if (drafts[i].active && drafts[i].tokens[i_dft] == drafts[s].tokens[i_dft]) {
339339
// synchronize active status for sequences with the same drafted token
340340
drafts[i].active = drafts[i].active && accept;
341341
if (!drafts[i].active) {

0 commit comments

Comments
 (0)