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.)

This commit is contained in:
Shyotl
2012-11-18 02:48:55 -06:00
parent 6b473c6edc
commit 9a9b5ce61e

View File

@@ -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