Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d41f0f84 authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by Android (Google) Code Review
Browse files

Merge "Prevent infinite loop in case of integer overflow."

parents e7784579 7a8fb26c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);