--- libaitcfg/src/queue.c 2014/03/19 17:00:51 1.14.4.2 +++ libaitcfg/src/queue.c 2014/03/19 17:44:48 1.14.4.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: queue.c,v 1.14.4.2 2014/03/19 17:00:51 misho Exp $ +* $Id: queue.c,v 1.14.4.3 2014/03/19 17:44:48 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -72,7 +72,7 @@ _selectAttribute(cfg_root_t * __restrict cfg, const ch do { if (!strcmp(AIT_GET_STR(&c->cfg_attr), csAttr)) return c; /* FOUND! */ - } while (RB_NEXT(tagRC, cfg, c) && !cfg_tree_cmp(c, &fav)); + } while ((c = RB_NEXT(tagRC, cfg, c)) && c && !cfg_tree_cmp(c, &fav)); return NULL; /* not found */ } } @@ -115,7 +115,8 @@ cfg_getSection(cfg_root_t * __restrict cfg, const char } else array_Push(arr, av, 0); - while (RB_NEXT(tagRC, cfg, av) && !strcmp(AIT_GET_STR(&av->cfg_sec), csSec)) + while ((av = RB_NEXT(tagRC, cfg, av)) && av && !AIT_ISEMPTY(&av->cfg_sec) && + !strcmp(AIT_GET_STR(&av->cfg_sec), csSec)) array_Push(arr, av, 0); return arr;