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

Commit 22cb2f46 authored by Adam Powell's avatar Adam Powell
Browse files

Fix monkey bug 2512055

Don't blow up when there aren't any menu items to layout in IconMenuView.

Change-Id: Ief08f0f8ed89aec4959d4d80cfd066dbe92dc3aa
parent 1a3786a3
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -179,6 +179,10 @@ public final class IconMenuView extends ViewGroup implements ItemInvoker, MenuVi
     */
    private void layoutItems(int width) {
        int numItems = getChildCount();
        if (numItems == 0) {
            mLayoutNumRows = 0;
            return;
        }
        
        // Start with the least possible number of rows
        int curNumRows =
@@ -470,16 +474,19 @@ public final class IconMenuView extends ViewGroup implements ItemInvoker, MenuVi
        
        // Get the desired height of the icon menu view (last row of items does
        // not have a divider below)
        final int layoutNumRows = mLayoutNumRows;
        final int desiredHeight = (mRowHeight + mHorizontalDividerHeight) *
                mLayoutNumRows - mHorizontalDividerHeight;
                layoutNumRows - mHorizontalDividerHeight;
        
        // Maximum possible width and desired height
        setMeasuredDimension(measuredWidth,
                resolveSize(desiredHeight, heightMeasureSpec));

        // Position the children
        if (layoutNumRows > 0) {
            positionChildren(mMeasuredWidth, mMeasuredHeight);
        }
    }


    @Override