[vlc-commits] commit: Lua: don't use empty strings for metas (close #3403) ( Fabio Ritrovato )

git at videolan.org git at videolan.org
Thu Mar 11 17:29:01 CET 2010


vlc | branch: master | Fabio Ritrovato <sephiroth87 at videolan.org> | Thu Mar 11 17:26:53 2010 +0100| [0074c723d073f6d24dc0bed82352357c2a31a1dc] | committer: Fabio Ritrovato 

Lua: don't use empty strings for metas (close #3403)

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

 modules/misc/lua/libs/sd.c |    4 ++--
 modules/misc/lua/vlc.c     |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/misc/lua/libs/sd.c b/modules/misc/lua/libs/sd.c
index facfbfb..f377ba1 100644
--- a/modules/misc/lua/libs/sd.c
+++ b/modules/misc/lua/libs/sd.c
@@ -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 ) );
diff --git a/modules/misc/lua/vlc.c b/modules/misc/lua/vlc.c
index f060166..c68de72 100644
--- a/modules/misc/lua/vlc.c
+++ b/modules/misc/lua/vlc.c
@@ -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 );                                \



More information about the vlc-commits mailing list