From 7dad178d867b06f285a8e37284e436f087d2db0d Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 15 Apr 2026 10:43:53 +0200 Subject: [PATCH] ResolutionShells: Don't allow zero resolution (calculating 1/d^2 gives NaN) --- common/ResolutionShells.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/ResolutionShells.cpp b/common/ResolutionShells.cpp index 9a9643fa..828a64c7 100644 --- a/common/ResolutionShells.cpp +++ b/common/ResolutionShells.cpp @@ -12,8 +12,10 @@ ResolutionShells::ResolutionShells(float d_min, float d_max, int32_t nshells) one_over_dmin2(1 / (d_min * d_min)), one_over_dmax2(1 / (d_max * d_max)), nshells(nshells) { - if (d_min >= d_max || d_min < 0) - throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Wrong resolution range"); + if (d_min <= 0) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Resolution must be above zero"); + if (d_min >= d_max) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Reversed resolution bounds"); if (nshells <= 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,