diff options
author | Hieu Hoang <s0565741@hel.inf.ed.ac.uk> | 2012-05-17 19:25:53 +0400 |
---|---|---|
committer | Hieu Hoang <s0565741@hel.inf.ed.ac.uk> | 2012-05-17 19:25:53 +0400 |
commit | 22ca90bd8abf7b22bea8a5c4db42eb38954b01c1 (patch) | |
tree | c166afa16aea30fc28b3127b06bff91a46e8e9ac /moses-cmd | |
parent | b46107231dc4a0f064bbae3cbda35be60f15dec8 (diff) |
Check factor is not null before outputting
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/src/IOWrapper.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/moses-cmd/src/IOWrapper.cpp b/moses-cmd/src/IOWrapper.cpp index 03133e092..4134db86a 100644 --- a/moses-cmd/src/IOWrapper.cpp +++ b/moses-cmd/src/IOWrapper.cpp @@ -198,9 +198,12 @@ void OutputSurface(std::ostream &out, const Hypothesis &edge, const std::vector< for (size_t pos = 0 ; pos < size ; pos++) { const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]); out << *factor; + CHECK(factor); for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) { const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]); + CHECK(factor); + out << "|" << *factor; } out << " "; @@ -307,6 +310,7 @@ void OutputBestHypo(const std::vector<Word>& mbrBestHypo, long /*translationId* for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) { const Factor *factor = mbrBestHypo[i].GetFactor(StaticData::Instance().GetOutputFactorOrder()[0]); + CHECK(factor); if (i>0) out << " " << *factor; else out << *factor; } |