input/item: slaves must have a valid priority
authorThomas Guillem <thomas@gllm.fr>
Thu, 19 May 2016 16:41:06 +0000 (18:41 +0200)
committerThomas Guillem <thomas@gllm.fr>
Thu, 19 May 2016 16:41:54 +0000 (18:41 +0200)
lib/media.c
src/input/item.c

index 5a52cb1..0b20aaa 100644 (file)
@@ -1178,8 +1178,7 @@ unsigned int libvlc_media_slaves_get( libvlc_media_t *p_md,
     for( int i = 0; i < i_count; ++i )
     {
         input_item_slave_t *p_item_slave = p_input_item->pp_slaves[i];
-        if( p_item_slave->i_priority == 0 )
-            continue;
+        assert( p_item_slave->i_priority >= SLAVE_PRIORITY_MATCH_NONE );
 
         libvlc_media_slave_t *p_slave = malloc( sizeof(*p_slave) +
                                                 strlen( p_item_slave->psz_uri )
index bce22e9..9478064 100644 (file)
@@ -660,7 +660,8 @@ input_item_slave_t *input_item_slave_New(const char *psz_uri, enum slave_type i_
 
 int input_item_AddSlave(input_item_t *p_item, input_item_slave_t *p_slave)
 {
-    if( p_item == NULL || p_slave == NULL )
+    if( p_item == NULL || p_slave == NULL
+     || p_slave->i_priority < SLAVE_PRIORITY_MATCH_NONE )
         return VLC_EGENERIC;
 
     vlc_mutex_lock( &p_item->lock );