]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix styles propagation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 28 May 2021 09:50:37 +0000 (10:50 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 28 May 2021 09:50:37 +0000 (10:50 +0100)
src/libserver/html/html.cxx
src/libserver/html/html_tag.hxx

index 15865533a359fea0a32f2b4eddea9bd44311e87c..2f124c65ff3979ca58986286b7906e49d0b76e02 100644 (file)
@@ -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();
 
index 3375931d17c18d63825e780d24d4b7d970f4ceb2..645c3433e3eb539399c1cff1c721af815f3979e0 100644 (file)
@@ -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;
 };
 
 }