commit b3355c2: [Minor] Html: Check for null before traversing

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jun 8 11:14:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-06-08 12:09:59 +0100
URL: https://github.com/rspamd/rspamd/commit/b3355c2ce40fb78906711a990cda0b5d54fedf58 (HEAD -> master)

[Minor] Html: Check for null before traversing

---
 src/libserver/html/html.hxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libserver/html/html.hxx b/src/libserver/html/html.hxx
index 5624f5d2e..99948ebbd 100644
--- a/src/libserver/html/html.hxx
+++ b/src/libserver/html/html.hxx
@@ -72,6 +72,10 @@ struct html_content {
 	auto traverse_tags(fu2::function<bool(const html_tag *)> &&func,
 					traverse_type how = traverse_type::PRE_ORDER) const -> bool {
 
+		if (root_tag == nullptr) {
+			return false;
+		}
+
 		auto rec_functor_pre_order = [&](const html_tag *root, auto &&rec) -> bool {
 			if (func(root)) {
 


More information about the Commits mailing list