Fixed parsing of Config from AMF / 3MF if it started with an empty line.

This bug was introduced with e947a29fc8
This commit is contained in:
Vojtech Bubnik 2021-08-30 17:56:58 +02:00
parent b5742eabe0
commit f92312b597

View File

@ -696,10 +696,8 @@ ConfigSubstitutions ConfigBase::load_from_ini_string_commented(std::string &&dat
for (size_t i = 0; i < data.size();) for (size_t i = 0; i < data.size();)
if (i == 0 || data[i] == '\n') { if (i == 0 || data[i] == '\n') {
// Start of a line. // Start of a line.
if (i != 0) { if (data[i] == '\n') {
// Consume LF. // Consume LF, don't keep empty lines.
assert(data[i] == '\n');
// Don't keep empty lines.
if (j > 0 && data[j - 1] != '\n') if (j > 0 && data[j - 1] != '\n')
data[j ++] = data[i]; data[j ++] = data[i];
++ i; ++ i;