changeset 25465:6b9447dc7590

Check availability before check argument for getting gamma properties.
author ulion
date Sat, 22 Dec 2007 08:35:15 +0000
parents 6f45e8b913cf
children 9ee347c404c9
files command.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Sat Dec 22 06:35:35 2007 +0000
+++ b/command.c	Sat Dec 22 08:35:15 2007 +0000
@@ -1059,7 +1059,7 @@
 static int mp_property_gamma(m_option_t * prop, int action, void *arg,
 			     MPContext * mpctx)
 {
-    int *gamma = prop->priv, r;
+    int *gamma = prop->priv, r, val;
 
     if (!mpctx->sh_video)
 	return M_PROPERTY_UNAVAILABLE;
@@ -1080,12 +1080,13 @@
 	    break;
 	return r;
     case M_PROPERTY_GET:
-	if (!arg)
-	    return M_PROPERTY_ERROR;
-	r = get_video_colors(mpctx->sh_video, prop->name, arg);
-	if (r <= 0)
-	    break;
-	return r;
+	if (get_video_colors(mpctx->sh_video, prop->name, &val) > 0) {
+	    if (!arg)
+		return M_PROPERTY_ERROR;
+	    *(int *)arg = val;
+	    return M_PROPERTY_OK;
+	}
+	break;
     case M_PROPERTY_STEP_UP:
     case M_PROPERTY_STEP_DOWN:
 	*gamma += (arg ? *(int *) arg : 1) *