Skip to content

Commit

Permalink
Fixed malformed HTML error for empty comments
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumBadger committed Jul 14, 2020
1 parent 4b0a787 commit fb374d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
92/1.12
Fixed malformed HTML error for empty comments
Improvements to copying to the clipboard (thanks to Cameron Merkel)
Translation updates (thanks to Allan Nordhøy, Artem, B0pol, Francisco Javier Meléndez Ruiz, Frans de Jonge, Gontzal Manuel Pujana Onaindia, Jeannette L, Jesper, JoC, Karol Kosek, marzzzello, mondstern, Piero Sangino, Riku Viitanen, Verdulo, Vladislav Glinsky, Xiang Xu, zeritti, and zmni!)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,17 @@ public static BodyElement parse(
final Context applicationContext = activity.getApplicationContext();

try {
HtmlRawElement rootElement
= HtmlRawElement.readFrom(new HtmlReaderPeekable(new HtmlReader(html)));
final HtmlReaderPeekable reader = new HtmlReaderPeekable(new HtmlReader(html));

HtmlRawElement rootElement;

if(reader.peek().type == TokenType.EOF) {
// Empty comment
rootElement = new HtmlRawElementPlainText("");

} else {
rootElement = HtmlRawElement.readFrom(reader);
}

if(!(rootElement instanceof HtmlRawElementBlock)) {
rootElement = new HtmlRawElementBlock(BlockType.NORMAL_TEXT, rootElement);
Expand Down

0 comments on commit fb374d7

Please sign in to comment.