X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Furl.c;h=da21a5702a6912499f333b42faa634a237764ab6;hb=38d6a34dd282abfa10f7d083a3f8161f0649acea;hp=25c60c37c334a540175c78881b6bcce6e12acace;hpb=faaa6a40adb643fa62ab355b3ab617af1e454fed;p=smdp.git diff --git a/src/url.c b/src/url.c index 25c60c3..da21a57 100644 --- a/src/url.c +++ b/src/url.c @@ -1,6 +1,6 @@ /* * Functions necessary to handle pandoc URLs. - * Copyright (C) 2014 Michael Goehler + * Copyright (C) 2016 Michael Goehler * * This file is part of mdp. * @@ -165,7 +165,7 @@ int url_count_inline(const wchar_t *line) { for (; *i; i++) { if (*i == '\\') { i++; - } else if ( *i == '[' && *(i+1) != ']') { + } else if ( *i == '[' && *(i+1) && *(i+1) != ']') { while (*i && *i != ']') i++; i++; if (*i == '(' && wcschr(i, ')')) { @@ -185,7 +185,7 @@ int url_len_inline(const wchar_t *value) { for (; *i; i++) { if (*i == '\\') { i++; - } else if ( *i == '[' && *(i+1) != ']') { + } else if ( *i == '[' && *(i+1) && *(i+1) != ']') { while (*i && *i != ']') i++; i++; if (*i == '(' && wcschr(i, ')')) {