summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-07-08 16:28:13 -0500
committerMatt Jordan <mjordan@digium.com>2015-07-12 18:11:05 -0500
commit458715d088a9b9401a3c54180b8256a02430e099 (patch)
treeb1abf21b8994f3f326c9d98d3291c4df1b0b9c65
parent59711b0eee26ce093b3fc50896880db00fe63939 (diff)
main/sorcery: Don't fail object set creation from JSON if field fails
Some individual fields may fail their conversion due to their default values being invalid for their custom handlers. In particular, configuration values that depend on others being enabled (and thus have an empty default value) are notorious for tripping this routine up. An example of this are any of the DTLS options for endpoints. Any of the DTLS options will fail to be applied (as DTLS is not enabled), causing the entire object set to be aborted. This patch makes it so that we log a debug message when skipping a field, and rumble on anyway. ASTERISK-25238 Change-Id: I0bea13de79f66bf9f9ae6ece0e94a2dc1c026a76
-rw-r--r--main/sorcery.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/sorcery.c b/main/sorcery.c
index 790e782cc..6d24b1486 100644
--- a/main/sorcery.c
+++ b/main/sorcery.c
@@ -1600,10 +1600,13 @@ struct ast_json *ast_sorcery_objectset_json_create(const struct ast_sorcery *sor
char *buf = NULL;
struct ast_json *value = NULL;
- if ((res = object_field->handler(object, object_field->args, &buf))
+ if (object_field->handler(object, object_field->args, &buf)
|| !(value = ast_json_string_create(buf))
|| ast_json_object_set(json, object_field->name, value)) {
- res = -1;
+ ast_free(buf);
+ ast_debug(5, "Skipping field '%s' for object type '%s'\n",
+ object_field->name, object_type->name);
+ continue;
}
ast_free(buf);