From e9362389e834d97ad2ef2a9c02d6c1fb57239524 Mon Sep 17 00:00:00 2001 From: Gereon Kremer Date: Mon, 26 Apr 2021 22:16:27 +0200 Subject: [PATCH] Protect int stats methods (#6442) This PR protects two methods of the IntStat class in case statistics are disabled. --- src/util/statistics_stats.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/util/statistics_stats.cpp b/src/util/statistics_stats.cpp index 971c592ac..1ecbf61ce 100644 --- a/src/util/statistics_stats.cpp +++ b/src/util/statistics_stats.cpp @@ -68,17 +68,23 @@ IntStat& IntStat::operator+=(int64_t val) void IntStat::maxAssign(int64_t val) { - if (d_data->d_value < val) + if constexpr (Configuration::isStatisticsBuild()) { - d_data->d_value = val; + if (d_data->d_value < val) + { + d_data->d_value = val; + } } } void IntStat::minAssign(int64_t val) { - if (d_data->d_value > val) + if constexpr (Configuration::isStatisticsBuild()) { - d_data->d_value = val; + if (d_data->d_value > val) + { + d_data->d_value = val; + } } } -- 2.30.2