Skip to content

Commit

Permalink
printer segfault on empty line
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuhoang committed Jun 8, 2018
1 parent c01be95 commit 7c41702
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/amun/common/printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ std::string GetSoftAlignmentString(const HypothesisPtr& hypothesis);
std::string GetNematusAlignmentString(const HypothesisPtr& hypothesis, std::string best, std::string source, unsigned linenum);

template <class OStream>
void Printer(const God &god, const History& history, OStream& out, const Sentence& sentence) {
void Printer(const God &god, const History& history, OStream& out, const Sentence& sentence)
{
if (sentence.size() == 0) {
// empty line
return;
}

auto bestTranslation = history.Top();
std::vector<std::string> bestSentenceWords = god.Postprocess(god.GetTargetVocab()(bestTranslation.first));

Expand Down

0 comments on commit 7c41702

Please sign in to comment.