From db5980b438b6bb573b12d394040988dfbbcbb725 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Tue, 8 Oct 2024 09:07:12 +0200 Subject: [PATCH] Fix warning: argument 1 null where non-null expected --- modules/core/include/visp3/core/vpIoTools.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/core/include/visp3/core/vpIoTools.h b/modules/core/include/visp3/core/vpIoTools.h index 6212a57ff8..1ef5371432 100644 --- a/modules/core/include/visp3/core/vpIoTools.h +++ b/modules/core/include/visp3/core/vpIoTools.h @@ -316,7 +316,9 @@ template void npz_save(std::string zipname, std::string fname, const //write everything fwrite(&local_header[0], sizeof(char), local_header.size(), fp); fwrite(&npy_header[0], sizeof(char), npy_header.size(), fp); - fwrite(&data[0], sizeof(T), nels, fp); + if (data != nullptr) { + fwrite(&data[0], sizeof(T), nels, fp); + } fwrite(&global_header[0], sizeof(char), global_header.size(), fp); fwrite(&footer[0], sizeof(char), footer.size(), fp); fclose(fp);