Skip to content

Commit

Permalink
fix(src): avoid possible infinite loop in LoadAll().
Browse files Browse the repository at this point in the history
Leave at first empty root.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Sep 12, 2024
1 parent 47cd272 commit 2297f2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 2297f2e

Please sign in to comment.