From fda0d427d730d54a2789faffd9547c9775bff9ce Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Thu, 7 Aug 2014 19:01:34 -0700 Subject: When normalize coordinate, return instead of assert() when divide by 0 BUG=382988 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/433293002 --- core/include/fxcrt/fx_coordinates.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 9a63e2a4ad..6ec3b5e1eb 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -156,7 +156,9 @@ public: void Normalize() { FX_FLOAT fLen = FXSYS_sqrt(FXT_PSV::x * FXT_PSV::x + FXT_PSV::y * FXT_PSV::y); - FXSYS_assert(fLen >= 0.0001f); + if (fLen < 0.0001f) { + return; + } FXT_PSV::x = ((baseType)FXT_PSV::x) / fLen; FXT_PSV::y = ((baseType)FXT_PSV::y) / fLen; } -- cgit v1.2.3