Skip to content

Commit 6c4cfd1

Browse files
committed
test: Fix HIL write-bin test
1 parent 9f720c4 commit 6c4cfd1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

espflash/src/bin/espflash.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ fn write_bin(args: WriteBinArgs, config: &Config) -> Result<()> {
350350

351351
// If the file size is not divisible by 4, we need to pad `FF` bytes to the end
352352
let size = f.metadata().into_diagnostic()?.len();
353-
let padded_bytes = 4 - (size % 4);
353+
let mut padded_bytes = 0;
354+
if size % 4 != 0 {
355+
padded_bytes = 4 - (size % 4);
356+
}
354357
let mut buffer = Vec::with_capacity(size.try_into().into_diagnostic()?);
355358
f.read_to_end(&mut buffer).into_diagnostic()?;
356359
buffer.extend_from_slice(&vec![0xFF; padded_bytes as usize]);

0 commit comments

Comments
 (0)