aboutsummaryrefslogtreecommitdiffstats
path: root/src/io
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-04-30 20:32:05 +0200
committerbptato <nincsnevem662@gmail.com>2023-04-30 20:32:05 +0200
commit5697627af260aba5c44ef3156dd0b1d53229f8e0 (patch)
treee55a80940fd2dc198a62477a95a3d8bfbef4803e /src/io
parent15fe78e9ffec7818a44838d71e99b4355374819d (diff)
downloadchawan-5697627af260aba5c44ef3156dd0b1d53229f8e0.tar.gz
only call Response.unregisterFun if not nil
Diffstat (limited to 'src/io')
-rw-r--r--src/io/request.nim6
1 files changed, 4 insertions, 2 deletions
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