Tree: Ignore empty lines.

Fixed:https://github.com/ArthurSonzogni/Diagon/issues/58
This commit is contained in:
ArthurSonzogni
2024-01-01 13:35:08 +01:00
parent 469264d88f
commit e00d9b6aa3
2 changed files with 12 additions and 1 deletions
+3
View File
@@ -1,5 +1,8 @@
# Current # Current
- Tree: Ignore emtpy lines.
# 1.1.156 (2023-05-08) # 1.1.156 (2023-05-08)
## Security: ## Security:
+9 -1
View File
@@ -319,8 +319,16 @@ class Tree : public Translator {
lines.push_back(line); lines.push_back(line);
} }
if (lines.size() == 0) if (lines.size() == 0) {
return ""; return "";
}
// Remove empty lines.
// See https://github.com/ArthurSonzogni/Diagon/issues/58
lines.erase(std::remove_if(
lines.begin(), lines.end(),
[](const Line& line) { return line.content.size() == 0; }),
lines.end());
// Build the tree. // Build the tree.
auto tree = std::make_unique<Node>(); auto tree = std::make_unique<Node>();