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-chart-cmd | |
parent | b46107231dc4a0f064bbae3cbda35be60f15dec8 (diff) |
Check factor is not null before outputting
Diffstat (limited to 'moses-chart-cmd')
-rw-r--r-- | moses-chart-cmd/src/IOWrapper.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/moses-chart-cmd/src/IOWrapper.cpp b/moses-chart-cmd/src/IOWrapper.cpp index f868479bc..cd8b1b74b 100644 --- a/moses-chart-cmd/src/IOWrapper.cpp +++ b/moses-chart-cmd/src/IOWrapper.cpp @@ -159,9 +159,12 @@ void OutputSurface(std::ostream &out, const Phrase &phrase, const std::vector<Fa 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 << " "; @@ -203,6 +206,8 @@ void IOWrapper::OutputBestHypo(const std::vector<const Factor*>& mbrBestHypo, l { for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) { const Factor *factor = mbrBestHypo[i]; + CHECK(factor); + cout << *factor << " "; } } |