[vlc-commits] Lua: fix existent sd loading

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


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

Lua: fix existent sd loading
(cherry picked from commit e0eb0da89ad97f609b785643804870d9b42659a3)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 8096ce4..f0d4cf2 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -192,7 +192,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;
@@ -248,7 +251,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