diff options
-rw-r--r-- | ezxml.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -16,11 +16,15 @@ int process(char *fn) { ezxml_t body = ezxml_get(ezdoc, "body", -1); if (!body) { - fprintf(stderr, "No body-tag found in file '%s'\n", fn); + fprintf(stderr, "No body-tag found in file '%s'. Exiting.\n", fn); + return 1; } + for (ezxml_t c = ezxml_child(body, "sec"); c; c = c->next) { ezxml_t t = ezxml_get(c, "title", -1); - printf("section-title: %s\n", t->txt); + if (t) { + printf("section-title: %s\n", t->txt); + } } printf("\n"); |