From c6fab363e60943d3e8ec784ea9170b022f200880 Mon Sep 17 00:00:00 2001 From: Nickolay Shmyrev Date: Sun, 9 Jan 2022 15:15:20 +0100 Subject: [PATCH] Don't close channel which not yet started --- src/batch_recognizer.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/batch_recognizer.cc b/src/batch_recognizer.cc index 28818692..ebc5a1bd 100644 --- a/src/batch_recognizer.cc +++ b/src/batch_recognizer.cc @@ -123,13 +123,14 @@ BatchRecognizer::~BatchRecognizer() { void BatchRecognizer::FinishStream(uint64_t id) { - Vector wave; - SubVector chunk(wave.Data(), 0); - dynamic_batcher_->Push(id, false, true, chunk); - streams_.erase(id); + if (streams_.find(id) != streams_.end()) { + Vector wave; + SubVector chunk(wave.Data(), 0); + dynamic_batcher_->Push(id, false, true, chunk); + streams_.erase(id); + } } - void BatchRecognizer::PushLattice(uint64_t id, CompactLattice &clat, BaseFloat offset) { fst::ScaleLattice(fst::GraphLatticeScale(0.9), &clat);