core: Fix segfault when invoking 'data get' CLI command

Invoking 'data get /asterisk/core/channeltypes' caused a crash because
of an assumption of a tech's capabilities to be non-NULL. The
'Surrogate' tech, however, does have a NULL capabilities member,
resulting in a crash.

ASTERISK-27108 #close

Change-Id: I2fbe7715681f43d5565d1e1599269468c26b0e0a
This commit is contained in:
Sean Bright
2017-07-05 08:42:07 -04:00
parent 9f4b3b966e
commit 6258de458b

View File

@@ -3145,6 +3145,10 @@ int ast_data_add_codecs(struct ast_data *root, const char *node_name, struct ast
return -1;
}
if (!cap) {
return 0;
}
count = ast_format_cap_count(cap);
for (i = 0; i < count; ++i) {
struct ast_format *fmt;