From c20cf5ebfd23691a88a72a282bf47262b5df8bbb Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Tue, 17 Mar 2009 15:12:16 +0000 Subject: [PATCH] Fixed an error in the xml writer, that occurred when two newlines appear next to each other. --- Cantera/src/base/xml.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index 5bea82193..0e2806486 100755 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -1240,14 +1240,18 @@ namespace Cantera { while (1 > 0) { ieol = vv.find('\n'); if (ieol != string::npos) { - int jf = ieol - 1; - for (int j = 0; j < (int) ieol; j++) { - if (! isspace(vv[j])) { - jf = j; - break; + if (ieol == 0) { + s << endl << indent << " "; + } else { + int jf = ieol - 1; + for (int j = 0; j < (int) ieol; j++) { + if (! isspace(vv[j])) { + jf = j; + break; + } } + s << endl << indent << " " << vv.substr(jf,ieol-jf); } - s << endl << indent << " " << vv.substr(jf,ieol-jf); vv = vv.substr(ieol+1); } else {