summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-08-07 19:01:34 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-08-07 19:01:34 -0700
commitfda0d427d730d54a2789faffd9547c9775bff9ce (patch)
treeea8aedda62cab1d80de198999915c83f63d4d384
parentdf449c0eb4b1fb5583da71265faf50a9a520be3c (diff)
downloadpdfium-fda0d427d730d54a2789faffd9547c9775bff9ce.tar.xz
When normalize coordinate, return instead of assert() when divide by 0
BUG=382988 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/433293002
-rw-r--r--core/include/fxcrt/fx_coordinates.h4
1 files changed, 3 insertions, 1 deletions
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;
}