commit 246e62c: [Minor] Damn C++ implicit conversions

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jan 11 21:28:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-01-11 21:21:43 +0000
URL: https://github.com/rspamd/rspamd/commit/246e62c22b261e521bdba1cc9476ab6c3b9bff3d (HEAD -> master)

[Minor] Damn C++ implicit conversions

---
 src/libserver/html/html.cxx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 4711a3caf..7fb0b091d 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -688,9 +688,11 @@ html_process_url_tag(rspamd_mempool_t *pool,
 			if (std::holds_alternative<std::monostate>(tag->extra)) {
 				tag->extra = url;
 			}
+
+			return url;
 		}
 
-		return url;
+		return std::nullopt;
 	}
 
 	return std::nullopt;
@@ -1449,7 +1451,7 @@ html_process_input(rspamd_mempool_t *pool,
 		if (cur_tag->flags & FL_HREF && html_document_state == html_document_state::body) {
 			auto maybe_url = html_process_url_tag(pool, cur_tag, hc);
 
-			if (maybe_url) {
+			if (maybe_url.has_value()) {
 				url = maybe_url.value();
 
 				if (url_set != NULL) {


More information about the Commits mailing list