From 255d7c967516ec25628e672375e1d851df0bd82e Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 25 Oct 2021 22:20:45 +0200 Subject: [PATCH] Fix CID 1400763 Using invalid iterator (fixes issue #2806) Signed-off-by: Stefan Weil --- src/ccmain/ltrresultiterator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ccmain/ltrresultiterator.cpp b/src/ccmain/ltrresultiterator.cpp index ae9172b04..9c939223a 100644 --- a/src/ccmain/ltrresultiterator.cpp +++ b/src/ccmain/ltrresultiterator.cpp @@ -432,7 +432,8 @@ ChoiceIterator::~ChoiceIterator() { // are none left. bool ChoiceIterator::Next() { if (oemLSTM_ && LSTM_choices_ != nullptr && !LSTM_choices_->empty()) { - if (LSTM_choice_it_ != LSTM_choices_->end() && next(LSTM_choice_it_) == LSTM_choices_->end()) { + if (LSTM_choice_it_ == LSTM_choices_->end() || + next(LSTM_choice_it_) == LSTM_choices_->end()) { return false; } else { ++LSTM_choice_it_;