Skip to content

Commit

Permalink
Tree: Ignore empty lines.
Browse files Browse the repository at this point in the history
Fixed:#58
  • Loading branch information
ArthurSonzogni committed Jan 1, 2024
1 parent 469264d commit e00d9b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Current

- Tree: Ignore emtpy lines.


# 1.1.156 (2023-05-08)

## Security:
Expand Down
10 changes: 9 additions & 1 deletion src/translator/tree/Tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,16 @@ class Tree : public Translator {
lines.push_back(line);
}

if (lines.size() == 0)
if (lines.size() == 0) {
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.
auto tree = std::make_unique<Node>();
Expand Down

0 comments on commit e00d9b6

Please sign in to comment.