[vlc-devel] [PATCH 12/12] vlc: subpicture_Delete: corrected broken documentation + implementation
Filip Roséen
filip at videolabs.io
Mon Mar 14 11:09:03 CET 2016
The function in question had "You may give it NULL" as documented
behavior, even though no branch existed to actually handle such cases
within the implementation.
This patch fixes that.
---
include/vlc_subpicture.h | 5 ++++-
src/misc/subpicture.c | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/vlc_subpicture.h b/include/vlc_subpicture.h
index e17d031..6d2aadc 100644
--- a/include/vlc_subpicture.h
+++ b/include/vlc_subpicture.h
@@ -191,7 +191,10 @@ VLC_API subpicture_t * subpicture_New( const subpicture_updater_t * );
/**
* This function delete a subpicture created by subpicture_New.
- * You may give it NULL.
+ *
+ * If the argument passed to the function is NULL, the function does nothing.
+ *
+ * \param p_subpic pointer to the subpicture to delete
*/
VLC_API void subpicture_Delete( subpicture_t *p_subpic );
diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c
index 2638bd0..47df5c2 100644
--- a/src/misc/subpicture.c
+++ b/src/misc/subpicture.c
@@ -82,6 +82,9 @@ subpicture_t *subpicture_New( const subpicture_updater_t *p_upd )
void subpicture_Delete( subpicture_t *p_subpic )
{
+ if( p_subpic == NULL )
+ return;
+
subpicture_region_ChainDelete( p_subpic->p_region );
p_subpic->p_region = NULL;
--
2.7.3
More information about the vlc-devel
mailing list