Skip to content

Commit 654f1b4

Browse files
committed
stream : check n_segments and continue if 0
1 parent de38850 commit 654f1b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/stream/stream.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,17 @@ int main(int argc, char ** argv) {
352352

353353
// print result;
354354
{
355+
const int n_segments = whisper_full_n_segments(ctx);
356+
if (n_segments == 0) {
357+
continue;
358+
}
355359
printf("\33[2K\r");
356360

357361
// print long empty line to clear the previous line
358362
printf("%s", std::string(100, ' ').c_str());
359363

360364
printf("\33[2K\r");
361365

362-
const int n_segments = whisper_full_n_segments(ctx);
363366
for (int i = 0; i < n_segments; ++i) {
364367
const char * text = whisper_full_get_segment_text(ctx, i);
365368

0 commit comments

Comments
 (0)