Unverified Commit 7830ae67 authored by Philip Gladstone's avatar Philip Gladstone Committed by GitHub
Browse files

Guard against freeing a ref of zero (#3308)

parent b9091784
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment