From ac039ec74fad8983e8826c5357f1a40d73a0970a Mon Sep 17 00:00:00 2001 From: krangelov Date: Tue, 28 May 2019 12:42:59 +0200 Subject: [PATCH] filter out empty cohorts --- src/runtime/c/pgf/scanner.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/runtime/c/pgf/scanner.c b/src/runtime/c/pgf/scanner.c index 71444ca25..cdbf56cc8 100644 --- a/src/runtime/c/pgf/scanner.c +++ b/src/runtime/c/pgf/scanner.c @@ -229,20 +229,20 @@ pgf_lookup_cohorts_helper(PgfCohortsState *state, PgfCohortSpot* spot, if (min <= len-1) pgf_lookup_cohorts_helper(state, spot, i, k-1, min, len-1); - if (seq->idx != NULL) { + if (seq->idx != NULL && gu_buf_length(seq->idx) > 0) { PgfCohortRange* range = gu_buf_insert(state->found, 0); range->start = *spot; range->end = current; range->buf = seq->idx; - - while (*current.ptr != 0) { - if (!skip_space(¤t.ptr, ¤t.pos)) - break; - } - - gu_buf_heap_push(state->spots, pgf_cohort_spot_order, ¤t); } + while (*current.ptr != 0) { + if (!skip_space(¤t.ptr, ¤t.pos)) + break; + } + + gu_buf_heap_push(state->spots, pgf_cohort_spot_order, ¤t); + if (len+1 <= max) pgf_lookup_cohorts_helper(state, spot, k+1, j, len+1, max);