summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ezxml.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ezxml.c b/ezxml.c
index b02400f..b267b40 100644
--- a/ezxml.c
+++ b/ezxml.c
@@ -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");