From 92f249dc62cf02a5052fee4e9877bc89b2be1ab5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 Feb 2021 00:23:48 +0100 Subject: [PATCH] zero size handling --- globalfunctions/arrayprinter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/globalfunctions/arrayprinter.cpp b/globalfunctions/arrayprinter.cpp index 7dc056b08..1404035ff 100644 --- a/globalfunctions/arrayprinter.cpp +++ b/globalfunctions/arrayprinter.cpp @@ -5,6 +5,15 @@ void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool printInfo, size_t maxCharPerLine) { + if(size == 0) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Size is zero, nothing to print" << std::endl; +#else + sif::printInfo("Size is zero, nothing to print\n"); +#endif + return; + } + #if FSFW_CPP_OSTREAM_ENABLED == 1 if(printInfo) { sif::info << "Printing data with size " << size << ": " << std::endl;