]> git.sesse.net Git - vlc/commitdiff
Lua: don't use empty strings for metas (close #3403)
authorFabio Ritrovato <sephiroth87@videolan.org>
Thu, 11 Mar 2010 16:26:53 +0000 (17:26 +0100)
committerFabio Ritrovato <sephiroth87@videolan.org>
Thu, 11 Mar 2010 16:26:53 +0000 (17:26 +0100)
modules/misc/lua/libs/sd.c
modules/misc/lua/vlc.c

index facfbfb0e79238f96588bb656bb6e8410980eb93..f377ba11453f35b00b37e8e0d832d186aa0b466c 100644 (file)
@@ -122,7 +122,7 @@ static int vlclua_sd_add_node( lua_State *L )
                                                             -1, ITEM_TYPE_NODE );
             free( name );
             lua_getfield( L, -1, "arturl" );
-            if( lua_isstring( L, -1 ) )
+            if( lua_isstring( L, -1 ) && strcmp( lua_tostring( L, -1 ), "" ) )
             {
                 char *psz_value = strdup( lua_tostring( L, -1 ) );
                 EnsureUTF8( psz_value );
@@ -291,7 +291,7 @@ static int vlclua_node_add_node( lua_State *L )
                                                                 name, 0, NULL, 0,
                                                                 -1, ITEM_TYPE_NODE );
                 free( name );
-                lua_getfield( L, -1, "arturl" );
+                if( lua_isstring( L, -1 ) && strcmp( lua_tostring( L, -1 ), "" ) )
                 if( lua_isstring( L, -1 ) )
                 {
                     char *psz_value = strdup( lua_tostring( L, -1 ) );
index f06016697c65a9a8d2e753ed79955c074ea2c9d5..c68de7222cd67c5c3506d20befb69c4842b6cb85 100644 (file)
@@ -320,7 +320,8 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
 {
 #define TRY_META( a, b )                                        \
     lua_getfield( L, -1, a );                                   \
-    if( lua_isstring( L, -1 ) )                                 \
+    if( lua_isstring( L, -1 ) &&                                \
+        strcmp( lua_tostring( L, -1 ), "" ) )                   \
     {                                                           \
         char *psz_value = strdup( lua_tostring( L, -1 ) );      \
         EnsureUTF8( psz_value );                                \