command: fix empty metadata case

show_text "${metadata}" crashed if no metadata was set.
This commit is contained in:
wm4 2013-06-11 12:18:36 +02:00
parent fbca1b179a
commit 6c3a1f68ff
1 changed files with 2 additions and 2 deletions

View File

@ -571,12 +571,12 @@ static int mp_property_metadata(m_option_t *prop, int action, void *arg,
case M_PROPERTY_PRINT: {
char **list = demuxer->info;
char *res = NULL;
for (int n = 0; list[n]; n += 2) {
for (int n = 0; list && list[n]; n += 2) {
res = talloc_asprintf_append_buffer(res, "%s: %s\n",
list[n], list[n + 1]);
}
*(char **)arg = res;
return M_PROPERTY_OK;
return res ? M_PROPERTY_OK : M_PROPERTY_UNAVAILABLE;
}
case M_PROPERTY_KEY_ACTION: {
struct m_property_action_arg *ka = arg;