]> git.sesse.net Git - vlc/commitdiff
Don't pop the string before using it (else our pointer points to garbage) and add...
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 4 Nov 2007 22:40:00 +0000 (22:40 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 4 Nov 2007 22:40:00 +0000 (22:40 +0000)
modules/misc/lua/vlc.c

index eb07f4fb9e8e67e48908d04e1e14666636195431..6299cea8bd9f8b7cd53c6960d0150f8cf78619a4 100644 (file)
@@ -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;
 }