diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/loader/response.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/loader/response.nim b/src/loader/response.nim index 5531da9d..9c173188 100644 --- a/src/loader/response.nim +++ b/src/loader/response.nim @@ -225,7 +225,11 @@ proc saveToBitmap*(response: Response; bmp: Bitmap): EmptyPromise = let size = bmp.width * bmp.height bmp.px = cast[seq[RGBAColorBE]](newSeqUninitialized[uint32](size)) response.opaque = opaque - response.onRead = onReadBitmap + if size > 0: + response.onRead = onReadBitmap + else: + response.unregisterFun() + response.body.sclose() response.bodyUsed = true response.resume() return response.bodyRead |