-rw-r--r-- | html.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -42,13 +42,13 @@ void htmlf(const char *format, ...) html(buf); } void html_txt(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='&') { *t = '\0'; html(txt); *t = c; if (c=='>') @@ -65,13 +65,13 @@ void html_txt(char *txt) html(txt); } void html_ntxt(int len, char *txt) { char *t = txt; - while(*t && len--){ + while(t && *t && len--){ int c = *t; if (c=='<' || c=='>' || c=='&') { *t = '\0'; html(txt); *t = c; if (c=='>') @@ -94,13 +94,13 @@ void html_ntxt(int len, char *txt) html("..."); } void html_attr(char *txt) { char *t = txt; - while(*t){ + while(t && *t){ int c = *t; if (c=='<' || c=='>' || c=='\'') { *t = '\0'; html(txt); *t = c; if (c=='>') @@ -152,7 +152,6 @@ void html_filemode(unsigned short mode) else html("-"); html_fileperm(mode >> 6); html_fileperm(mode >> 3); html_fileperm(mode); } - |