From 8e79b7dc528b97dba14d3da8be2e19f9ad95228c Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Thu, 24 Nov 2022 12:16:43 +0000 Subject: [PATCH] Fix error detection for reading a page to pad unset bytes --- src/avr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/avr.c b/src/avr.c index e926cc84..6d5b975c 100644 --- a/src/avr.c +++ b/src/avr.c @@ -960,7 +960,7 @@ int avr_write_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, int continue; // Read flash contents to separate memory spc and fill in holes - if(avr_read_page_default(pgm, p, cm, beg, spc) == 0) { + if(avr_read_page_default(pgm, p, cm, beg, spc) >= 0) { pmsg_notice2("padding %s [0x%04x, 0x%04x]\n", cm->desc, beg, end-1); for(i = beg; i < end; i++) if(!(cm->tags[i] & TAG_ALLOCATED)) {