Commit 0074c723 authored by Fabio Ritrovato's avatar Fabio Ritrovato

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

parent b5014d72
...@@ -122,7 +122,7 @@ static int vlclua_sd_add_node( lua_State *L ) ...@@ -122,7 +122,7 @@ static int vlclua_sd_add_node( lua_State *L )
-1, ITEM_TYPE_NODE ); -1, ITEM_TYPE_NODE );
free( name ); free( name );
lua_getfield( L, -1, "arturl" ); 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 ) ); char *psz_value = strdup( lua_tostring( L, -1 ) );
EnsureUTF8( psz_value ); EnsureUTF8( psz_value );
...@@ -291,7 +291,7 @@ static int vlclua_node_add_node( lua_State *L ) ...@@ -291,7 +291,7 @@ static int vlclua_node_add_node( lua_State *L )
name, 0, NULL, 0, name, 0, NULL, 0,
-1, ITEM_TYPE_NODE ); -1, ITEM_TYPE_NODE );
free( name ); free( name );
lua_getfield( L, -1, "arturl" ); if( lua_isstring( L, -1 ) && strcmp( lua_tostring( L, -1 ), "" ) )
if( lua_isstring( L, -1 ) ) if( lua_isstring( L, -1 ) )
{ {
char *psz_value = strdup( lua_tostring( L, -1 ) ); char *psz_value = strdup( lua_tostring( L, -1 ) );
......
...@@ -320,7 +320,8 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L, ...@@ -320,7 +320,8 @@ void __vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L,
{ {
#define TRY_META( a, b ) \ #define TRY_META( a, b ) \
lua_getfield( L, -1, a ); \ 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 ) ); \ char *psz_value = strdup( lua_tostring( L, -1 ) ); \
EnsureUTF8( psz_value ); \ EnsureUTF8( psz_value ); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment