From cb5101282b9a3210944c7fdc77b013c9ca699787 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 29 Oct 2022 13:51:48 -0500 Subject: [PATCH] firmware/sagas: fix checksum validation The checksum can be 0, so we can't be lazy and use `!checksum` to test for undefined. Issue: https://github.com/pybricks/support/issues/724#issuecomment-1295929316 --- CHANGELOG.md | 3 +++ src/firmware/sagas.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23db9b1a..b620101c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ - Added feature create new empty file ([pybricks-code#771]). - Added sponsor button ([support#719]). +### Fixed +- Fixed firmware checksum validation when checksum === 0. + [pybricks-code#771]: https://github.com/pybricks/pybricks-code/issues/771 [support#719]: https://github.com/pybricks/support/issues/719 diff --git a/src/firmware/sagas.ts b/src/firmware/sagas.ts index 957d8eba..6ef85cc5 100644 --- a/src/firmware/sagas.ts +++ b/src/firmware/sagas.ts @@ -309,7 +309,7 @@ function* loadFirmware( } })(); - if (!checksum) { + if (checksum === undefined) { // FIXME: we should return error/throw instead yield* put( didFailToFinish( @@ -352,7 +352,7 @@ function* loadFirmware( } })(); - if (!checksum) { + if (checksum === undefined) { // FIXME: we should return error/throw instead yield* put( didFailToFinish(