Skip to content

Commit 11e229d

Browse files
David BetzDavid Betz
authored andcommitted
Don't try to validate files that are being written to an SD card.
1 parent 211db6d commit 11e229d

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/main.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,21 @@ int main(int argc, char *argv[])
282282
nmessage(ERROR_CANT_OPEN_FILE, file);
283283
return 1;
284284
}
285-
switch (PropImage::validate(image, imageSize)) {
286-
case PropImage::SUCCESS:
287-
// success
288-
break;
289-
case PropImage::IMAGE_TRUNCATED:
290-
nmessage(ERROR_FILE_TRUNCATED);
291-
return 1;
292-
case PropImage::IMAGE_CORRUPTED:
293-
nmessage(ERROR_FILE_CORRUPTED);
294-
return 1;
295-
default:
296-
nmessage(ERROR_INTERNAL_CODE_ERROR);
297-
return 1;
285+
if (!writeFile) {
286+
switch (PropImage::validate(image, imageSize)) {
287+
case PropImage::SUCCESS:
288+
// success
289+
break;
290+
case PropImage::IMAGE_TRUNCATED:
291+
nmessage(ERROR_FILE_TRUNCATED);
292+
return 1;
293+
case PropImage::IMAGE_CORRUPTED:
294+
nmessage(ERROR_FILE_CORRUPTED);
295+
return 1;
296+
default:
297+
nmessage(ERROR_INTERNAL_CODE_ERROR);
298+
return 1;
299+
}
298300
}
299301
}
300302

0 commit comments

Comments
 (0)