From 72276ed43a19bc2fdd086d93f10bfefcfbd72465 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 8 May 2023 13:30:01 +0200 Subject: [PATCH] JFJochReceiver: if no images sent, return compressed ratio of 0 --- receiver/JFJochReceiver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/receiver/JFJochReceiver.cpp b/receiver/JFJochReceiver.cpp index d6f24935..56d2f5b3 100644 --- a/receiver/JFJochReceiver.cpp +++ b/receiver/JFJochReceiver.cpp @@ -504,13 +504,14 @@ void JFJochReceiver::GetStatistics(JFJochProtoBuf::ReceiverOutput &ret) const { ret.set_compressed_size(compressed_size); ret.set_max_image_number_sent(max_image_number_sent); - if (experiment.GetImageNum() > 0) { + if ((experiment.GetImageNum() > 0) && (compressed_size > 0)) { ret.set_compressed_ratio( static_cast (images_sent * experiment.GetPixelDepth() * experiment.GetModulesNum() * RAW_MODULE_SIZE) / static_cast (compressed_size)); - } + } else + ret.set_compressed_ratio(0); if (!max_delay.empty()) ret.set_max_receive_delay(*std::max_element(max_delay.begin(), max_delay.end()));