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) {
Parser parser(input);
while (true) {
NodeBuilder builder;
if (!parser.HandleNextDocument(builder)) {
if (!parser.HandleNextDocument(builder) || builder.Root().IsNull()) {
break;
}
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