diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-15 14:12:39 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-15 14:12:39 +0200 |
commit | be602072f517f841ee29a76f8119b030ec3d869b (patch) | |
tree | 9278a65c21849090a8ea0cb5515ecc6775b3b19b | |
parent | d18d2687d74b27583e3d09e3ff719f1e073c1732 (diff) | |
download | grecs-be602072f517f841ee29a76f8119b030ec3d869b.tar.gz grecs-be602072f517f841ee29a76f8119b030ec3d869b.tar.bz2 |
Bugfix in node formatting code
* src/format.c (grecs_format_node_path)
(grecs_format_node_path): don't coredump on NULL values.
-rw-r--r-- | src/format.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/format.c b/src/format.c index d010729..cff4019 100644 --- a/src/format.c +++ b/src/format.c @@ -1,5 +1,5 @@ /* grecs - Gray's Extensible Configuration System - Copyright (C) 2007-2012 Sergey Poznyakoff + Copyright (C) 2007-2015 Sergey Poznyakoff Grecs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -242,6 +242,11 @@ grecs_format_node_path(struct grecs_node *node, int flags, { char delim[2] = "."; + if (!node) { + clos->fmtfun("NULL", clos->data); + return; + } + if (node->up) grecs_format_node_path(node->up, flags, clos); if (node->type == grecs_node_root) @@ -321,6 +326,11 @@ grecs_format_node(struct grecs_node *node, int flags, return 1; } + if (!node) { + clos->fmtfun("NULL", clos->data); + return 0; + } + switch (node->type) { case grecs_node_root: case grecs_node_block: |