]> git.sesse.net Git - vlc/commitdiff
variables: add a warning when adding a callback to a non existant variable.
authorRémi Duraffort <ivoire@videolan.org>
Mon, 14 Sep 2009 17:40:27 +0000 (19:40 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 14 Sep 2009 20:32:26 +0000 (22:32 +0200)
src/misc/variables.c

index 1134326984892e023bff96ff6c5c141456bd117d..8c4122d4834a98794be9e56fc122a9b79377807c 100644 (file)
@@ -621,11 +621,8 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
                 p_var->psz_text = NULL;
             break;
         case VLC_VAR_GETTEXT:
-            p_val->psz_string = NULL;
-            if( p_var->psz_text )
-            {
-                p_val->psz_string = strdup( p_var->psz_text );
-            }
+            p_val->psz_string = p_var->psz_text ? strdup( p_var->psz_text )
+                                                : NULL;
             break;
         case VLC_VAR_INHERITVALUE:
             {
@@ -915,6 +912,10 @@ int __var_AddCallback( vlc_object_t *p_this, const char *psz_name,
     i_var = GetUnused( p_this, psz_name );
     if( i_var < 0 )
     {
+#ifndef NDEBUG
+        msg_Warn( p_this, "Failed to add a callback to the non-existing "
+                          "variable '%s'", psz_name );
+#endif
         vlc_mutex_unlock( &p_priv->var_lock );
         return i_var;
     }