From 4aed1813110464356b318a58bf048f0afb637325 Mon Sep 17 00:00:00 2001 From: maartenkeijzer Date: Sun, 11 Feb 2001 16:25:03 +0000 Subject: [PATCH] Removed small bug in reading outside a buffer in eoParser::readFrom This caused the parser to crash when a simple flag of the form program -f was given. --- eo/src/utils/eoParser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eo/src/utils/eoParser.cpp b/eo/src/utils/eoParser.cpp index ffbcffc9..00881337 100644 --- a/eo/src/utils/eoParser.cpp +++ b/eo/src/utils/eoParser.cpp @@ -142,9 +142,9 @@ void eoParser::updateParameters() const void eoParser::readFrom(istream& is) { string str; - while (is >> str) { + if (str[0] == '#') { // skip the rest of the line string tempStr; @@ -179,7 +179,9 @@ void eoParser::readFrom(istream& is) } else // it should be a char { - string value(str.begin() + 3, str.end()); + string value = "1"; + if (str.size() > 2) + value = string(str.begin() + 3, str.end()); shortNameMap[str[1]] = value; } }