summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-11 12:18:36 +0200
committerwm4 <wm4@nowhere>2013-06-11 12:24:11 +0200
commit6c3a1f68ff81763c72eb00b19dc4469adc8cc33c (patch)
treec8e7bde8ee8561993b17eda9494928326ae8b613 /core
parentfbca1b179a7e6dd6df530cfd62906c0d0fd60d9d (diff)
downloadmpv-6c3a1f68ff81763c72eb00b19dc4469adc8cc33c.tar.bz2
mpv-6c3a1f68ff81763c72eb00b19dc4469adc8cc33c.tar.xz
command: fix empty metadata case
show_text "${metadata}" crashed if no metadata was set.
Diffstat (limited to 'core')
-rw-r--r--core/command.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/command.c b/core/command.c
index 31097e1030..8ba58867dd 100644
--- a/core/command.c
+++ b/core/command.c
@@ -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;