commit 89b98cb: [Minor] Fix styles propagation

Vsevolod Stakhov vsevolod at highsecure.ru
Fri May 28 10:07:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-05-28 10:50:37 +0100
URL: https://github.com/rspamd/rspamd/commit/89b98cbd7c8cdbfa923e68cbeab4001b7b3aa28c

[Minor] Fix styles propagation

---
 src/libserver/html/html.cxx     |  4 ++++
 src/libserver/html/html_tag.hxx | 12 ++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 15865533a..2f124c65f 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -1583,6 +1583,10 @@ html_propagate_style(struct html_content *hc,
 	struct html_block *bl_parent;
 	gboolean push_block = FALSE;
 
+	if (blocks.empty()) {
+		/* No blocks to propagate */
+		return;
+	}
 	/* Propagate from the parent if needed */
 	bl_parent = blocks.back();
 
diff --git a/src/libserver/html/html_tag.hxx b/src/libserver/html/html_tag.hxx
index 3375931d1..645c3433e 100644
--- a/src/libserver/html/html_tag.hxx
+++ b/src/libserver/html/html_tag.hxx
@@ -42,17 +42,17 @@ enum class html_component_type : std::uint8_t {
 using html_tag_extra_t = std::variant<std::monostate, struct rspamd_url *, struct html_image *>;
 
 struct html_tag {
-	gint id;
-	gint flags;
-	guint content_length;
-	goffset content_offset;
+	gint id = -1;
+	gint flags = 0;
+	guint content_length = 0;
+	goffset content_offset = 0;
 
 	std::string_view name;
 	robin_hood::unordered_flat_map<html_component_type, std::string_view> parameters;
 
 	html_tag_extra_t extra;
-	struct html_block *block; /* TODO: temporary, must be handled by css */
-	GNode *parent;
+	struct html_block *block = nullptr; /* TODO: temporary, must be handled by css */
+	GNode *parent = nullptr;
 };
 
 }


More information about the Commits mailing list