From f11310f395a135ac7ef204ced5b3d3facf491422 Mon Sep 17 00:00:00 2001 From: ztenghui Date: Wed, 14 May 2014 13:48:27 -0700 Subject: [PATCH] Check the array before accessing it TODO: Figure out why the path is generating empty polygon. bug: 14615368 Change-Id: If116e34388b7c6a71bf5ddd36e0c9716d7450732 --- libs/hwui/ShadowTessellator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp index be49aed999340..55b82e490ae2a 100644 --- a/libs/hwui/ShadowTessellator.cpp +++ b/libs/hwui/ShadowTessellator.cpp @@ -196,6 +196,10 @@ Vector2 ShadowTessellator::centroid2d(const Vector2* poly, int polyLength) { * @param len the number of points of the polygon */ bool ShadowTessellator::isClockwise(const Vector2* polygon, int len) { + if (len < 2 || polygon == NULL) { + ALOGW("Invalid polygon %p, length is %d @ isClockwise()", polygon, len); + return true; + } double sum = 0; double p1x = polygon[len - 1].x; double p1y = polygon[len - 1].y;