diff --git a/nimPNG.nim b/nimPNG.nim index 707a65b..aa01934 100644 --- a/nimPNG.nim +++ b/nimPNG.nim @@ -896,7 +896,7 @@ proc parsePNG(s: Stream, settings: PNGDecoder): PNG = let length = s.readInt32BE() let chunkType = PNGChunkType(s.readInt32BE()) - let data = s.readStr(length) + let data = if length == 0: "" else: s.readStr(length) let crc = cast[uint32](s.readInt32BE()) let calculatedCRC = crc32(crc32(0, $chunkType), data) if calculatedCRC != crc and not PNGDecoder(png.settings).ignoreCRC: diff --git a/nimPNG.nimble b/nimPNG.nimble index c8ac8b3..346da5b 100644 --- a/nimPNG.nimble +++ b/nimPNG.nimble @@ -1,5 +1,5 @@ # Package -version = "0.2.1" +version = "0.2.2" author = "Andri Lim" description = "PNG encoder and decoder" license = "MIT"