Commit 1b653546 authored by Antoine Cellerier's avatar Antoine Cellerier

Don't pop the string before using it (else our pointer points to garbage) and...

Don't pop the string before using it (else our pointer points to garbage) and add a user friendly error message in vlclua_stream_new.
parent de31813f
......@@ -180,11 +180,11 @@ int vlclua_stream_new( lua_State *L )
vlc_object_t * p_this = vlclua_get_this( L );
stream_t * p_stream;
const char * psz_url;
if( lua_gettop( L ) != 1 ) return vlclua_error( L );
psz_url = luaL_checkstring( L, -1 );
lua_pop( L, 1 );
p_stream = stream_UrlNew( p_this, psz_url );
if( !p_stream ) return vlclua_error( L );
if( !p_stream )
return luaL_error( L, "Error when opening url: `%s'", psz_url );
lua_pop( L, 1 );
lua_pushlightuserdata( L, p_stream );
return 1;
}
......
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