diff options
author | LemonBoy <thatlemon@gmail.com> | 2016-11-29 23:08:45 +0100 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2016-11-29 23:08:45 +0100 |
commit | 7fb84b5b7d471d62333a94bc0d6e5032ede7c2c7 (patch) | |
tree | 27039d740068a1b1fbdecebbba4944b1fc7bde5c /src/lib-config | |
parent | 1aff5c2c97b452ffdb5c59cf62f29048731b9f40 (diff) | |
download | irssi-7fb84b5b7d471d62333a94bc0d6e5032ede7c2c7.zip |
Enforce the is_node_list contract in lib-config setters.
An assertion failure is better than a segfault.
Diffstat (limited to 'src/lib-config')
-rw-r--r-- | src/lib-config/set.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib-config/set.c b/src/lib-config/set.c index 7ca55871..0de6c503 100644 --- a/src/lib-config/set.c +++ b/src/lib-config/set.c @@ -82,6 +82,7 @@ void config_node_clear(CONFIG_REC *rec, CONFIG_NODE *node) void config_nodes_remove_all(CONFIG_REC *rec) { g_return_if_fail(rec != NULL); + g_return_if_fail(is_node_list(rec->mainnode)); while (rec->mainnode->value != NULL) config_node_remove(rec, rec->mainnode, ((GSList *) rec->mainnode->value)->data); @@ -94,6 +95,7 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, g_return_if_fail(rec != NULL); g_return_if_fail(parent != NULL); + g_return_if_fail(is_node_list(parent)); no_key = key == NULL; node = no_key ? NULL : config_node_find(parent, key); |