Skip to content

Commit

Permalink
Fix issue reported by Coverity Scan
Browse files Browse the repository at this point in the history
CID: 1375395 (Dereference after null check)

Signed-off-by: Noah Metzger <[email protected]>
  • Loading branch information
noahmetzger committed Jul 31, 2018
1 parent 83a4eb3 commit d4490af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lstm/recodebeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,10 @@ void RecodeBeamSearch::ContinueContext(const RecodeNode* prev, int index,
(previous->duplicate || previous->code == null_char_)) {
previous = previous->prev;
}
prefix.Set(p, previous->code);
full_code.Set(p, previous->code);
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) {
Expand Down

0 comments on commit d4490af

Please sign in to comment.