Skip to content

Commit 492c020

Browse files
ringaboutPMunch
authored andcommitted
callback cannot be nil (nim-lang#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
1 parent 67077ba commit 492c020

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/std/tasks.nim

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ proc `=destroy`*(t: var Task) {.inline.} =
7575

7676
proc invoke*(task: Task) {.inline.} =
7777
## Invokes the `task`.
78+
assert task.callback != nil
7879
task.callback(task.args)
7980

8081
template checkIsolate(scratchAssignList: seq[NimNode], procParam, scratchDotExpr: NimNode) =

0 commit comments

Comments
 (0)