From 06d3aa27fba630ce46189d4da94fa8f38fe01d81 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 16 Jan 2008 05:46:39 +0000 Subject: [PATCH] Add NULL check and remove dead code. --- mxmldoc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mxmldoc.c b/mxmldoc.c index b1658e4..9eef34f 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -4,7 +4,7 @@ * Documentation generator using Mini-XML, a small XML-like file parsing * library. * - * Copyright 2003-2007 by Michael Sweet. + * Copyright 2003-2008 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -1227,9 +1227,12 @@ scan_file(const char *filename, /* I - Filename */ if (!strcmp(node->value.text.string, "(")) break; - for (node = node->next; node; node = node->next) - if (strcmp(node->value.text.string, "*")) - break; + if (node) + { + for (node = node->next; node; node = node->next) + if (strcmp(node->value.text.string, "*")) + break; + } if (node) { @@ -1282,7 +1285,6 @@ scan_file(const char *filename, /* I - Filename */ #ifdef DEBUG fputs("Identifier: <<<< , >>>\n", stderr); #endif /* DEBUG */ - ch = type->last_child->value.text.string[0]; mxmlNewText(type, 0, ","); } break;