From 04178bd86eab3b23b5cb5962cc5be7dfa59fff17 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Mon, 11 Mar 2024 16:57:44 +0000 Subject: [PATCH] MIR-650 Exception terminates mir-get-data: HEALPix nested ordering with N=1 --- src/mir/reorder/HEALPix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mir/reorder/HEALPix.cc b/src/mir/reorder/HEALPix.cc index 5898d3897..b6215c1d9 100644 --- a/src/mir/reorder/HEALPix.cc +++ b/src/mir/reorder/HEALPix.cc @@ -185,8 +185,8 @@ int HEALPixReorder::ring_to_nest(int r) const { p -= 8 * Nside_; } - int i = (r + p) >> 1; - int j = (r - p) >> 1; + int i = std::max(0, (r + p)) >> 1; + int j = std::max(0, (r - p)) >> 1; ASSERT(f < 12 && i < Nside_ && j < Nside_); return CodecFijNest::fij_to_nest(f, i, j, k_);