[vlc-commits] Lua: fix existent sd loading

Jean-Baptiste Kempf git at videolan.org
Tue Jan 31 22:08:32 CET 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Jan 31 22:08:23 2012 +0100| [e0eb0da89ad97f609b785643804870d9b42659a3] | committer: Jean-Baptiste Kempf

Lua: fix existent sd loading

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

 modules/lua/libs/sd.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index a6e2e09..48a2434 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -188,7 +188,10 @@ static int vlclua_sd_add_node( lua_State *L )
                 }
                 lua_pop( L, 1 );
                 lua_getfield( L, -1, "category" );
-                services_discovery_AddItem( p_sd, p_input, luaL_checkstring( L, -1 ) );
+                if( lua_isstring( L, -1 ) )
+                    services_discovery_AddItem( p_sd, p_input, luaL_checkstring( L, -1 ) );
+                else
+                    services_discovery_AddItem( p_sd, p_input, NULL );
                 input_item_t **udata = (input_item_t **)
                                        lua_newuserdata( L, sizeof( input_item_t * ) );
                 *udata = p_input;
@@ -244,7 +247,10 @@ static int vlclua_sd_add_item( lua_State *L )
                     msg_Warn( p_sd, "Item duration should be a number (in seconds)." );
                 lua_pop( L, 1 );
                 lua_getfield( L, -1, "category" );
-                services_discovery_AddItem( p_sd, p_input, luaL_checkstring( L, -1 ) );
+                if( lua_isstring( L, -1 ) )
+                    services_discovery_AddItem( p_sd, p_input, luaL_checkstring( L, -1 ) );
+                else
+                    services_discovery_AddItem( p_sd, p_input, NULL );
                 lua_pop( L, 1 );
                 input_item_t **udata = (input_item_t **)
                                        lua_newuserdata( L, sizeof( input_item_t * ) );



More information about the vlc-commits mailing list