From d4b1103bd73f96e1f1518dc0fc08a8bceafd48f0 Mon Sep 17 00:00:00 2001 From: bojar Date: Wed, 21 Mar 2007 00:52:28 +0000 Subject: [PATCH] Fixed the case when the intersection of two alignments is empty. Used to throw std::out_of_range at basic_string::replace, now emits an empty line. git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1320 1f5c12ca-751b-0410-a591-d2e778427230 --- scripts/training/symal/symal.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/training/symal/symal.cpp b/scripts/training/symal/symal.cpp index be368013e..ffb817b83 100644 --- a/scripts/training/symal/symal.cpp +++ b/scripts/training/symal/symal.cpp @@ -150,7 +150,10 @@ int printersect(fstream& out,int m,int *a,int n,int* b){ //fix the last " " string str = sout.str(); - str.replace(str.length()-1,1,"\n"); + if (str.length() == 0) + str = "\n"; + else + str.replace(str.length()-1,1,"\n"); out << str; out.flush();