diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-09-28 09:36:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-09-28 09:36:40 -0300 |
commit | cee94df6e081b625a353bdd9a716cb8ef625e4cf (patch) | |
tree | 0ee1d679a0506d19ad81871f9598122abc132b7b /lauxlib.c | |
parent | fcc46467fa92c8e9951e63baf2c3e1b22bf20a1f (diff) | |
download | lua-cee94df6e081b625a353bdd9a716cb8ef625e4cf.tar.gz lua-cee94df6e081b625a353bdd9a716cb8ef625e4cf.tar.bz2 lua-cee94df6e081b625a353bdd9a716cb8ef625e4cf.zip |
function list in luaL_register may be NULL for an empty list
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.190 2009/07/15 17:47:34 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.191 2009/09/18 18:58:45 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -672,7 +672,8 @@ LUALIB_API void luaL_register (lua_State *L, const char *libname, | |||
672 | } | 672 | } |
673 | lua_remove(L, -2); /* remove _LOADED table */ | 673 | lua_remove(L, -2); /* remove _LOADED table */ |
674 | } | 674 | } |
675 | for (; l->name; l++) { | 675 | if (l == NULL) return; /* nothing to register? */ |
676 | for (; l->name; l++) { /* else fill the table with given functions */ | ||
676 | lua_pushcfunction(L, l->func); | 677 | lua_pushcfunction(L, l->func); |
677 | lua_setfield(L, -2, l->name); | 678 | lua_setfield(L, -2, l->name); |
678 | } | 679 | } |