From 70b940c307c4fca95ca95a08b4aa79dc64a4003b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 29 Feb 2020 17:06:57 +0100 Subject: [PATCH] LibMarkdown: Fix breakage from Vector using size_t It's no longer possible rely on negative VectorIterator when iterating backwards. It would be nice to have a general solution for reverse iteration, but for now let me just patch this up. --- Libraries/LibMarkdown/MDText.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibMarkdown/MDText.cpp b/Libraries/LibMarkdown/MDText.cpp index c75b26556e..f0b7dc15b8 100644 --- a/Libraries/LibMarkdown/MDText.cpp +++ b/Libraries/LibMarkdown/MDText.cpp @@ -73,8 +73,8 @@ String MDText::render_to_html() const // not be open for the new span. Close // it and all the open tags that follow // it. - for (auto it2 = --open_tags.end(); it2 >= it; --it2) { - const String& tag = *it2; + for (ssize_t j = open_tags.size() - 1; j >= static_cast(it.index()); --j) { + auto& tag = open_tags[j]; builder.appendf("", tag.characters()); if (tag == "a") { current_style.href = {}; @@ -101,8 +101,8 @@ String MDText::render_to_html() const builder.append(span.text); } - for (auto it = --open_tags.end(); it >= open_tags.begin(); --it) { - const String& tag = *it; + for (ssize_t i = open_tags.size() - 1; i >= 0; --i) { + auto& tag = open_tags[i]; builder.appendf("", tag.characters()); }