[grilo-plugins] lua-factory: don't iterate on lua env table



commit 56f51487d7989a0c987767f38baad2f7046d441f
Author: Victor Toso <me victortoso com>
Date:   Thu Jul 17 00:46:41 2014 -0300

    lua-factory: don't iterate on lua env table
    
    When calling a c function in lua, the top of the stack is the
    environment table of lua, _G.
    
    This patch fixes the case where GrlNetWc options was not passed
    at grl.fetch and grl.unzip functions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733289

 src/lua-factory/grl-lua-library.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index 9a46e6a..2594cd8 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -522,7 +522,7 @@ net_wc_new_with_options(lua_State *L,
   GrlNetWc *wc;
 
   wc = grl_net_wc_new ();
-  if (lua_istable (L, arg_offset)) {
+  if (arg_offset < lua_gettop (L) && lua_istable (L, arg_offset)) {
     /* Set GrlNetWc options */
     lua_pushnil (L);
     while (lua_next (L, arg_offset) != 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]