mirror of
https://github.com/php-win-ext/php-lua.git
synced 2026-03-24 00:52:12 +01:00
make lua_obj optional
so that printing a function would not cause crash
This commit is contained in:
5
lua.c
5
lua.c
@@ -355,11 +355,6 @@ zval *php_lua_get_zval_from_lua(lua_State *L, int index, zval *lua_obj, zval *rv
|
||||
case LUA_TFUNCTION:
|
||||
{
|
||||
long ref_id = 0;
|
||||
if (!lua_obj) {
|
||||
php_error_docref(NULL, E_WARNING, "corrupted Lua object");
|
||||
break;
|
||||
}
|
||||
|
||||
lua_pushvalue(L, index);
|
||||
ref_id = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ zval* php_lua_closure_instance(zval *instance, long ref_id, zval *lua_obj) {
|
||||
object_init_ex(instance, lua_closure_ce);
|
||||
objval = php_lua_closure_object_from_zend_object(Z_OBJ_P(instance));
|
||||
objval->closure = ref_id;
|
||||
ZVAL_ZVAL(&(objval->lua), lua_obj, 1, 0);
|
||||
if (lua_obj) {
|
||||
ZVAL_ZVAL(&(objval->lua), lua_obj, 1, 0);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user