Browse Source

JsonParser::error(): Don't add trailing newline

Alexander Wilms 1 year ago
parent
commit
466318b77b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lib/json/JsonParser.cpp

+ 6 - 1
lib/json/JsonParser.cpp

@@ -587,7 +587,12 @@ bool JsonParser::error(const std::string & message, bool warning)
 	std::ostringstream stream;
 	std::string type(warning ? " warning: " : " error: ");
 
-	stream << "At line " << lineCount << ", position " << pos - lineStart << type << message << "\n";
+	if(errors != "")
+	{
+		// only add the line breaks between error messages so we don't have a trailing line break
+		stream << "\n";
+	}
+	stream << "At line " << lineCount << ", position " << pos - lineStart << type << message;
 	errors += stream.str();
 
 	return warning;