summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-01 21:50:54 +0200
committerwm4 <wm4@nowhere>2014-09-01 21:50:54 +0200
commit0aaf688c2d39a9e7a4753ffd94a6bc7995eeed23 (patch)
tree934bc2aa1582a0d47b96e2e194ab002c2444d88a
parent4124a175e1b4bd3b41e47db24ed851ad05b9ba04 (diff)
downloadmpv-0aaf688c2d39a9e7a4753ffd94a6bc7995eeed23.tar.bz2
mpv-0aaf688c2d39a9e7a4753ffd94a6bc7995eeed23.tar.xz
command: make m_property_strdup_ro with NULL mean unavailable
This catches a few cases which basically call: m_property_strdup_ro(..., ..., NULL) which would return NULL strings. This should generally be avoided (although it's allowed due to reasons), and it seems most callers actually intend this to mean M_PROPERTY_UNAVAILABLE.
-rw-r--r--options/m_property.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/options/m_property.c b/options/m_property.c
index 015313036a..b5f9025617 100644
--- a/options/m_property.c
+++ b/options/m_property.c
@@ -442,6 +442,8 @@ int m_property_double_ro(int action, void *arg, double var)
int m_property_strdup_ro(int action, void* arg, const char *var)
{
+ if (!var)
+ return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_GET:
*(char **)arg = talloc_strdup(NULL, var);