From 04e125d52f700426e94158a69a496a834e7953ce Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 16 Mar 2018 22:30:25 +0000 Subject: util.async: You can never have too many asserts! --- util/async.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util') diff --git a/util/async.lua b/util/async.lua index 3a75e1c1..e16d5b24 100644 --- a/util/async.lua +++ b/util/async.lua @@ -23,6 +23,8 @@ local function runner_continue(thread) local level = 0; while debug.getinfo(thread, level, "") do level = level + 1; end ok, runner = debug.getlocal(thread, level-1, 1); + assert(ok == "self", "unexpected async state: variable mismatch"); + assert(runner.thread == thread, "unexpected async state: thread mismatch"); local error_handler = runner.watchers.error; if error_handler then error_handler(runner, debug.traceback(thread, err)); end local ready_handler = runner.watchers.ready; -- cgit v1.2.3