[vlc-devel] [PATCH 10/12] vlc: input_item_node_Delete: do nothing if argument is NULL

Filip Roséen filip at videolabs.io
Mon Mar 14 11:09:01 CET 2016


---
 include/vlc_input_item.h | 4 ++++
 src/input/item.c         | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 8d20efa..ee66213 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -168,6 +168,10 @@ VLC_API void input_item_node_Sort( input_item_node_t *p_node,
 
 /**
  * Delete a node created with input_item_node_Create() and all its children.
+ *
+ * If the argument passed to the function is NULL, the function does nothing.
+ *
+ * \param p_node pointer to the node to delete.
  */
 VLC_API void input_item_node_Delete( input_item_node_t *p_node );
 
diff --git a/src/input/item.c b/src/input/item.c
index b27beee..45cfef6 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1120,6 +1120,9 @@ static void RecursiveNodeDelete( input_item_node_t *p_node )
 
 void input_item_node_Delete( input_item_node_t *p_node )
 {
+    if( p_node == NULL )
+        return;
+
     if( p_node->p_parent )
         for( int i = 0; i < p_node->p_parent->i_children; i++ )
             if( p_node->p_parent->pp_children[i] == p_node )
-- 
2.7.3



More information about the vlc-devel mailing list