mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fixed infinite loops after includes and at eof
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@32 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -91,6 +91,11 @@ void Reader::readLine() {
|
|||||||
key.clear();
|
key.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (key.empty() && input->Eof()) {
|
||||||
|
// end of file
|
||||||
|
indent = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
key = cannocial_name_form(trim(line.substr(indent, pos - indent)));
|
key = cannocial_name_form(trim(line.substr(indent, pos - indent)));
|
||||||
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
|
value = pos == String::npos ? _("") : trim_left(line.substr(pos+1));
|
||||||
}
|
}
|
||||||
@@ -112,7 +117,7 @@ template <> void Reader::handle(String& s) {
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
// read all lines that are indented enough
|
// read all lines that are indented enough
|
||||||
readLine();
|
readLine();
|
||||||
while (indent >= expected_indent) {
|
while (indent >= expected_indent && !input->Eof()) {
|
||||||
if (!first) multi_line_str += _('\n');
|
if (!first) multi_line_str += _('\n');
|
||||||
first = false;
|
first = false;
|
||||||
multi_line_str += line.substr(expected_indent); // strip expected indent
|
multi_line_str += line.substr(expected_indent); // strip expected indent
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class Reader {
|
|||||||
if (key == _("include_file")) {
|
if (key == _("include_file")) {
|
||||||
Reader reader(value);
|
Reader reader(value);
|
||||||
reader.handle(v);
|
reader.handle(v);
|
||||||
|
moveNext();
|
||||||
} else {
|
} else {
|
||||||
unknownKey();
|
unknownKey();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user