From 88d45d641c859eb1714d5e7e917dab0ed354fc9f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 2 Aug 2022 22:49:25 +0200 Subject: [PATCH] Do not create empty dump files --- client/src/fileutils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/src/fileutils.c b/client/src/fileutils.c index 8e68ed03f..41831c7cf 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -1952,6 +1952,11 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl } int pm3_save_dump(const char *fn, uint8_t *d, size_t n, JSONFileType jsft, size_t blocksize) { + if (n == 0) { + PrintAndLogEx(INFO, "No data to save. Skipping..."); + return PM3_EINVARG; + } + saveFile(fn, ".bin", d, n); saveFileEML(fn, d, n, blocksize); saveFileJSON(fn, jsft, d, n, NULL);