From e893ad24ee9f9fa553ae67812b523bcc9a26e0e2 Mon Sep 17 00:00:00 2001 From: ExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com> Date: Sun, 10 May 2020 22:01:42 +0200 Subject: [PATCH] Fixed sum crash when file size is a mult of 16384 Crash happened when file is mult of 16384, which means last block size is zero and it crashed because of data[-1] --- grmn/chksum.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grmn/chksum.py b/grmn/chksum.py index c0de702..56f09f9 100644 --- a/grmn/chksum.py +++ b/grmn/chksum.py @@ -15,7 +15,8 @@ class ChkSum: with open(filename, "rb") as f: while True: block = f.read(blocksize) - self.add(block) + if len(block) != 0: + self.add(block) if print_progress: print(".", end="", flush=True) if len(block) < blocksize: