When normalize coordinate, return instead of assert() when divide by 0
authorBo Xu <bo_xu@foxitsoftware.com>
Fri, 8 Aug 2014 02:01:34 +0000 (19:01 -0700)
committerBo Xu <bo_xu@foxitsoftware.com>
Fri, 8 Aug 2014 02:01:34 +0000 (19:01 -0700)
BUG=382988
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/433293002

core/include/fxcrt/fx_coordinates.h

index 9a63e2a..6ec3b5e 100644 (file)
@@ -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;
     }