summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2014-05-14 13:48:27 -0700
committerTenghui Zhu <ztenghui@google.com>2014-05-14 21:02:45 +0000
commitf11310f395a135ac7ef204ced5b3d3facf491422 (patch)
treea039ab5b3d4bd4c3ef02af6aad3f333256ded718 /libs
parent50a2fb9ea743b1d23ece0d744ae9c2886286039d (diff)
downloadframeworks_base-f11310f395a135ac7ef204ced5b3d3facf491422.zip
frameworks_base-f11310f395a135ac7ef204ced5b3d3facf491422.tar.gz
frameworks_base-f11310f395a135ac7ef204ced5b3d3facf491422.tar.bz2
Check the array before accessing it
TODO: Figure out why the path is generating empty polygon. bug: 14615368 Change-Id: If116e34388b7c6a71bf5ddd36e0c9716d7450732
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/ShadowTessellator.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index be49aed..55b82e4 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;