Welcome to little lamb

Code » qmdoc » commit 0d6b04b

Don't parse links without a target

author Olivier Brunel
2023-01-13 10:44:05 UTC
committer Olivier Brunel
2023-01-13 10:54:17 UTC
parent 1b6ef5296b4a2ef05fe47631b871ec377f2d5271

Don't parse links without a target

src/main.c +3 -0

diff --git a/src/main.c b/src/main.c
index 75c7158..a990402 100644
--- a/src/main.c
+++ b/src/main.c
@@ -887,6 +887,9 @@ enter_span(MD_SPANTYPE type, void *details, void *ctx_)
                 if (get_section(&d->href)) {
                     BUFFERING_ON();
                     ctx->doc.flags |= DOC_BUFFERED_A;
+                } else if (!d->href.size) {
+                    warn("Link without target");
+                    return ERR_PARSER_ENTER_SPAN;
                 } else {
                     if (!raw_str(ctx, "<a href=\"") || !attribute(ctx, &d->href))
                         return ERR_PARSER_ENTER_SPAN;