summaryrefslogtreecommitdiff
path: root/decoder/viterbi.h
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/viterbi.h')
-rw-r--r--decoder/viterbi.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/decoder/viterbi.h b/decoder/viterbi.h
index e78cd157..ac0b9a11 100644
--- a/decoder/viterbi.h
+++ b/decoder/viterbi.h
@@ -55,6 +55,8 @@ typename WeightFunction::Weight Viterbi(const Hypergraph& hg,
antsb[k] = &vit_result[edgeb.tail_nodes_[k]];
traverse(edgeb, antsb, cur_node_best_result);
}
+ if (vit_result.empty())
+ return WeightType(0);
std::swap(*result, vit_result.back());
return vit_weight.back();
}