summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2015-01-15 12:12:39 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2015-01-15 12:12:39 (GMT)
commitbe602072f517f841ee29a76f8119b030ec3d869b (patch) (side-by-side diff)
tree9278a65c21849090a8ea0cb5515ecc6775b3b19b /src
parentd18d2687d74b27583e3d09e3ff719f1e073c1732 (diff)
downloadgrecs-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.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/format.c12
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:

Return to:

Send suggestions and report system problems to the System administrator.