From 4f2c6c86db3a3f102c169597982dc6f885a26e19 Mon Sep 17 00:00:00 2001 From: abn Date: Thu, 11 Apr 2024 16:14:34 +0200 Subject: [PATCH] Minor bug fix seen by '-fsanitize' --- src/INTERP_KERNEL/TransformedTriangleIntersect.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx b/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx index 9fc3a1674..36727ef26 100644 --- a/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx +++ b/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx @@ -342,9 +342,14 @@ namespace INTERP_KERNEL for(int j = 0 ; j < 2; ++j) { const int dpIdx = DP_INDEX[3*facets[j] + i]; - const DoubleProduct dp = DP_FOR_SEG_FACET_INTERSECTION[dpIdx]; - const double sign = SIGN_FOR_SEG_FACET_INTERSECTION[dpIdx]; - c[j] = dpIdx < 0.0 ? 0.0 : sign * calcStableC(seg, dp); + if (dpIdx != -1) + { + const DoubleProduct dp = DP_FOR_SEG_FACET_INTERSECTION[dpIdx]; + const double sign = SIGN_FOR_SEG_FACET_INTERSECTION[dpIdx]; + c[j] = sign * calcStableC(seg, dp); + } + else + c[j] = 0.0; } pt[i] = (c[0] * s[0] + c[1] * s[1]) / denominator; -- 2.39.2