diff --git a/convert.c b/convert.c index 308fa3f..a6a41ba 100644 --- a/convert.c +++ b/convert.c @@ -250,6 +250,8 @@ CHECK_PARAM_NOT_NULL(w); while (w) { char *s = word_string (w); + if (!s) + return; if (*s == '\\') { ++s; if (!strncmp (s, "yr", 2) && isdigit(s[2])) { @@ -333,6 +335,8 @@ if ((w2=w->child)) { tmp = word_string (w2); + if(!tmp) + break; if (!strncmp("\\f",tmp,2)) { num = atoi (&tmp[2]); name[0]=0; @@ -461,14 +465,15 @@ char *s; s = word_string(child); - + if (!s) + return; if (!inline_mode) { if (!strcmp("\\title", s)) { printf (op->document_title_begin); w2=child->next; while (w2) { char *s2 = word_string(w2); - if (s2[0] != '\\') + if (s2 && s2[0] != '\\') printf ("%s", s2); w2=w2->next; } @@ -479,7 +484,7 @@ w2=child->next; while (w2) { char *s2 = word_string(w2); - if (s2[0] != '\\') + if (s2 && s2[0] != '\\') printf ("%s,", s2); w2=w2->next; } @@ -490,7 +495,7 @@ w2=child->next; while (w2) { char *s2 = word_string(w2); - if (s2[0] != '\\') + if (s2 && s2[0] != '\\') printf ("%s", s2); w2=w2->next; } @@ -502,7 +507,7 @@ w2=child->next; while (w2) { char *s2 = word_string(w2); - if (s2[0] != '\\') + if (s2 && s2[0] != '\\') printf ("%s", s2); w2=w2->next; } @@ -612,10 +617,10 @@ r=g=b=0; while(w) { - if (total_colors >= MAX_COLORS) { + char *s = word_string (w); + if (s == 0 || total_colors >= MAX_COLORS) { break; } - char *s = word_string (w); #if 0 printf (op->comment_begin); @@ -777,7 +782,7 @@ if(s && !strcmp(s, "SYMBOL") ) { w4=w3->next; - while(w4 && !strcmp(word_string(w4), " ")) + while(w4 && word_string(w4) && !strcmp(word_string(w4), " ")) w4 = w4->next; s4 = word_string(w4); if(s4) @@ -795,7 +800,7 @@ Word *w4; char *s4; w4=w3->next; - while (w4 && !strcmp(" ", word_string(w4))) + while (w4 && word_string(w4) && !strcmp(" ", word_string(w4))) w4=w4->next; if (w4) { s4=word_string(w4);