author | Olivier Brunel
<jjk@jjacky.com> 2023-05-25 13:51:25 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-07-05 07:52:50 UTC |
parent | 6ae23674fd578e0b6e6bd62e12d22f3ac4ea0745 |
src/main.c | +4 | -4 |
diff --git a/src/main.c b/src/main.c index 8c0e93d..8f0fd23 100644 --- a/src/main.c +++ b/src/main.c @@ -326,8 +326,8 @@ get_section(MD_ATTRIBUTE *attr) MD_SIZE l = attr->substr_offsets[1] - attr->substr_offsets[0]; if (attr->substr_types[0] != MD_TEXT_NORMAL || l != 1 - || !(*s >= '1' && *s <= '8')) - return 0; + || !(*s >= '0' && *s <= '8')) + return -1; return *s - '0'; } @@ -912,7 +912,7 @@ enter_span(MD_SPANTYPE type, void *details, void *ctx_) { MD_SPAN_A_DETAIL *d = details; - if (get_section(&d->href)) { + if (get_section(&d->href) >= 0) { BUFFERING_ON(); ctx->doc.flags |= DOC_BUFFERED_A; } else if (!d->href.size) { @@ -1022,7 +1022,7 @@ leave_span(MD_SPANTYPE type, void *details, void *ctx_) BUFFERING_OFF(s, l); ctx->doc.flags &= ~DOC_BUFFERED_A; - if (!section) + if (section < 0) return ERR_PARSER_LEAVE_SPAN; char buf[UINT32_FMT + 2];