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);