From bc671571091601f446d1dc07dbba4df6c775e757 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Thu, 12 Sep 2024 14:16:15 +0200 Subject: [PATCH] fix(src): avoid possible infinite loop in LoadAll(). Leave at first empty root. Signed-off-by: Federico Di Pierro --- src/parse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse.cpp b/src/parse.cpp index 262536b..4cfab77 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -53,7 +53,7 @@ std::vector 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());