OSDN Git Service

Fix NPE when inflating GradientDrawables.
authorTim Kilbourn <tkilbourn@google.com>
Tue, 25 Mar 2014 17:13:02 +0000 (10:13 -0700)
committerTim Kilbourn <tkilbourn@google.com>
Tue, 25 Mar 2014 17:13:02 +0000 (10:13 -0700)
Change-Id: If624d6efac61dabe6009ee4368ad7b119e1d4dcd

graphics/java/android/graphics/drawable/GradientDrawable.java

index 1568e99..1b5cefe 100644 (file)
@@ -1009,7 +1009,7 @@ public class GradientDrawable extends Drawable {
             }
 
             if (state.mInnerRadius == -1
-                    && themeAttrs == null || themeAttrs[R.styleable.GradientDrawable_thicknessRatio] == 0) {
+                    && (themeAttrs == null || themeAttrs[R.styleable.GradientDrawable_thicknessRatio] == 0)) {
                 state.mInnerRadiusRatio = a.getFloat(
                         R.styleable.GradientDrawable_innerRadiusRatio, DEFAULT_INNER_RADIUS_RATIO);
             }
@@ -1020,7 +1020,7 @@ public class GradientDrawable extends Drawable {
             }
 
             if (state.mThickness == -1
-                    && themeAttrs == null || themeAttrs[R.styleable.GradientDrawable_thicknessRatio] == 0) {
+                    && (themeAttrs == null || themeAttrs[R.styleable.GradientDrawable_thicknessRatio] == 0)) {
                 state.mThicknessRatio = a.getFloat(
                         R.styleable.GradientDrawable_thicknessRatio, DEFAULT_THICKNESS_RATIO);
             }