Fix issue reported by Coverity Scan

CID: 1375395 (Dereference after null check)

Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
This commit is contained in:
Noah Metzger 2018-07-31 10:43:39 +02:00
parent 83a4eb3b44
commit d4490af06d

View File

@ -512,9 +512,11 @@ void RecodeBeamSearch::ContinueContext(const RecodeNode* prev, int index,
(previous->duplicate || previous->code == null_char_)) {
previous = previous->prev;
}
if (previous != nullptr) {
prefix.Set(p, previous->code);
full_code.Set(p, previous->code);
}
}
if (prev != nullptr && !is_simple_text_) {
if (top_n_flags_[prev->code] == top_n_flag) {
if (prev_cont != NC_NO_DUP) {