mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
Guard against freeing a ref of zero (#3308)
This commit is contained in:
parent
90a077b987
commit
ff778dfc4b
@ -416,7 +416,9 @@ static int gpio_pulse_start(lua_State *L) {
|
||||
return luaL_error( L, "missing callback" );
|
||||
}
|
||||
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, pulser->cb_ref);
|
||||
if (pulser->cb_ref) {
|
||||
luaL_unref(L, LUA_REGISTRYINDEX, pulser->cb_ref);
|
||||
}
|
||||
pulser->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
|
||||
active_pulser = pulser;
|
||||
|
Loading…
x
Reference in New Issue
Block a user