summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-04-15 01:14:14 +0800
committerGitHub <noreply@github.com>2021-04-14 19:14:14 +0200
commit44657b78c40475e60187b48157bae41ea5371252 (patch)
tree09495be60a55a48126a69fbb827fd1a1fea43769 /lib
parent58f44c8b4e6486789a08555dccee6492d32575d4 (diff)
downloadNim-44657b78c40475e60187b48157bae41ea5371252.tar.gz
callback cannot be nil (#17718)
`Task.callback` cannot be nil, we need to raise it at debug and release mode

Situations:
- if users create a Task object without using `toTask` and invoke the Task
- if users already move the Task and invoke the Task
Diffstat (limited to 'lib')
-rw-r--r--lib/std/tasks.nim1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/std/tasks.nim b/lib/std/tasks.nim
index 6b7f86ce4..aed36f985 100644
--- a/lib/std/tasks.nim
+++ b/lib/std/tasks.nim
@@ -75,6 +75,7 @@ proc `=destroy`*(t: var Task) {.inline.} =
 
 proc invoke*(task: Task) {.inline.} =
   ## Invokes the `task`.
+  assert task.callback != nil
   task.callback(task.args)
 
 template checkIsolate(scratchAssignList: seq[NimNode], procParam, scratchDotExpr: NimNode) =