From 9a9b5ce61ea027eea47e7659c097f44208cd3d10 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sun, 18 Nov 2012 02:48:55 -0600 Subject: [PATCH] LLRectBase<>::clipPointToRect could divide by zero, resulting in the resulting clampd values being invalid under some scenarios (worldmap panning could cause the mouse cursor to 'restore' to an invalid location upon mouseclick release.) --- indra/llmath/llrect.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llmath/llrect.h b/indra/llmath/llrect.h index d7595dcee..d476ad3e6 100644 --- a/indra/llmath/llrect.h +++ b/indra/llmath/llrect.h @@ -124,8 +124,8 @@ public: if (end_y < mBottom) clip_y = end_y - mBottom; // clip_? and delta_? should have same sign, since starting point is in rect // so ratios will be positive - F32 ratio_x = ((F32)clip_x / (F32)delta_x); - F32 ratio_y = ((F32)clip_y / (F32)delta_y); + F32 ratio_x = delta_x ? ((F32)clip_x / (F32)delta_x) : 0.f; + F32 ratio_y = delta_y ? ((F32)clip_y / (F32)delta_y) : 0.f; if (ratio_x > ratio_y) { // clip along x direction