Commit bc671571 by Federico Di Pierro Committed by Jesse Beder

fix(src): avoid possible infinite loop in LoadAll().

Leave at first empty root.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
parent da82fd98
...@@ -53,7 +53,7 @@ std::vector<Node> LoadAll(std::istream& input) { ...@@ -53,7 +53,7 @@ std::vector<Node> LoadAll(std::istream& input) {
Parser parser(input); Parser parser(input);
while (true) { while (true) {
NodeBuilder builder; NodeBuilder builder;
if (!parser.HandleNextDocument(builder)) { if (!parser.HandleNextDocument(builder) || builder.Root().IsNull()) {
break; break;
} }
docs.push_back(builder.Root()); docs.push_back(builder.Root());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment