ensure tmr ref is valid before cb occurs

This commit is contained in:
Kit Klein 2021-01-04 21:06:50 -05:00 committed by Nathaniel Wesley Filardo
parent 7c07f91483
commit 1b77d5d3b5
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ static void alarm_timer_task(task_param_t param, task_prio_t prio)
{
tmr_t tmr = (tmr_t)param;
lua_State* L = lua_getstate();
if (tmr->cb_ref == LUA_NOREF)
if (tmr->cb_ref == LUA_NOREF || tmr->self_ref == LUA_NOREF)
return;
lua_rawgeti(L, LUA_REGISTRYINDEX, tmr->cb_ref);
lua_rawgeti(L, LUA_REGISTRYINDEX, tmr->self_ref);