From 5697627af260aba5c44ef3156dd0b1d53229f8e0 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 30 Apr 2023 20:32:05 +0200 Subject: only call Response.unregisterFun if not nil --- src/io/request.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/io/request.nim b/src/io/request.nim index d61a19fa..72631bed 100644 --- a/src/io/request.nim +++ b/src/io/request.nim @@ -216,7 +216,8 @@ proc text*(response: Response): string {.jsfunc.} = result = response.body.readAll() response.body.close() response.bodyUsed = true - response.unregisterFun() + if response.unregisterFun != nil: + response.unregisterFun() #TODO: get rid of this proc readAll*(response: Response): string {.jsfunc.} = @@ -235,7 +236,8 @@ proc close*(response: Response) {.jsfunc.} = #TODO: this looks pretty unsafe response.body.close() response.bodyUsed = true - response.unregisterFun() + if response.unregisterFun != nil: + response.unregisterFun() func credentialsMode*(attribute: CORSAttribute): CredentialsMode = case attribute -- cgit 1.4.1-2-gfad0