summaryrefslogtreecommitdiffhomepage
path: root/libs/core/src/luci_cutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/core/src/luci_cutil.c')
-rw-r--r--libs/core/src/luci_cutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/core/src/luci_cutil.c b/libs/core/src/luci_cutil.c
index 001273b55..9f56c432b 100644
--- a/libs/core/src/luci_cutil.c
+++ b/libs/core/src/luci_cutil.c
@@ -91,11 +91,13 @@ static int luci__instantiate(lua_State *L) {
/* luci.cutil.class(baseclass) */
static int luci_class(lua_State *L) {
+ int n = lua_gettop(L);
+
/* Create class */
lua_newtable(L);
/* Create metatable and register parent class if any */
- if (lua_istable(L, 1)) {
+ if (n && lua_istable(L, 1)) {
lua_createtable(L, 0, 2);
lua_pushvalue(L, 1);
lua_setfield(L, -2, "__index");