[vlc-commits] Lua: check vlclua_get_playlist_internal() for NULL
Rémi Denis-Courmont
git at videolan.org
Sun Jan 5 12:44:58 CET 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 5 13:30:54 2014 +0200| [3ccae49f75ceb5f38b8f7c4fcfaba4d7a7e3f8b6] | committer: Rémi Denis-Courmont
Lua: check vlclua_get_playlist_internal() for NULL
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3ccae49f75ceb5f38b8f7c4fcfaba4d7a7e3f8b6
---
modules/lua/libs/input.c | 11 +++++++++--
modules/lua/libs/objects.c | 15 ++++++++++-----
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index f161a4a..3e347bf 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -62,9 +62,16 @@ input_thread_t * vlclua_get_input_internal( lua_State *L )
return p_input;
}
}
+
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- input_thread_t *p_input = playlist_CurrentInput( p_playlist );
- return p_input;
+ if( p_playlist != NULL )
+ {
+ input_thread_t *p_input = playlist_CurrentInput( p_playlist );
+ if( p_input )
+ return p_input;
+ }
+
+ return NULL;
}
static int vlclua_input_item_info( lua_State *L )
diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index 265e367..287a42c 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -128,11 +128,16 @@ static int vlclua_get_vout( lua_State *L )
static int vlclua_get_aout( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
- audio_output_t *p_aout = playlist_GetAout( p_playlist );
- if( p_aout != NULL )
- vlclua_push_vlc_object( L, (vlc_object_t *)p_aout );
- else
- lua_pushnil( L );
+ if( p_playlist != NULL )
+ {
+ audio_output_t *p_aout = playlist_GetAout( p_playlist );
+ if( p_aout != NULL )
+ {
+ vlclua_push_vlc_object( L, (vlc_object_t *)p_aout );
+ return 1;
+ }
+ }
+ lua_pushnil( L );
return 1;
}
/*****************************************************************************
More information about the vlc-commits
mailing list