diff options
| -rw-r--r-- | core/java/android/widget/GridLayout.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 258424a2e574..ef6628a20063 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -1752,7 +1752,8 @@ public class GridLayout extends ViewGroup { boolean validSolution = true; // do a binary search to find the max delta that won't conflict with constraints while(deltaMin < deltaMax) { - final int delta = (deltaMin + deltaMax) / 2; + // cast to long to prevent overflow. + final int delta = (int) (((long) deltaMin + deltaMax) / 2); invalidateValues(); shareOutDelta(delta, totalWeight); validSolution = solve(getArcs(), a, false); |