[vlc-commits] variables: var_InheritBool: return false if a variable doesn't exist

Thomas Guillem git at videolan.org
Thu Oct 12 13:45:19 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 12 13:24:44 2017 +0200| [1532b7f5796e69ffbc3c118f60237329caf9f04e] | committer: Thomas Guillem

variables: var_InheritBool: return false if a variable doesn't exist

config_GetInt() returns -1 if the variable doesn't exist.

As var_GetBool() returns false if the variable doesn't exist, it's safe to
assume that var_InheritBool() should do the same.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1532b7f5796e69ffbc3c118f60237329caf9f04e
---

 src/misc/variables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 87a9c27478..810c8ffc81 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1194,7 +1194,7 @@ int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type,
             p_val->i_int = config_GetInt( p_this, psz_name );
             break;
         case VLC_VAR_BOOL:
-            p_val->b_bool = config_GetInt( p_this, psz_name );
+            p_val->b_bool = config_GetInt( p_this, psz_name ) > 0;
             break;
         default:
             vlc_assert_unreachable();



More information about the vlc-commits mailing list