johannilsson/android-actionbar — Issue #49: crash: removal of the actions from actionbar
Author: hashfold
Created: 2012-01-07 17:24:27+00:00
State: open

I used "Remove Action" button to remove all the actions one by one.
it crashes when I tried to remove further, its because there are no more actions to be removed.
in this case the actionIndex = -1 and number of child nodes in actionView is 0.

below is the fix works great:

/**
* Remove a action from the action bar.
* @param index position of action to remove
* HashFold: no-op in case of removal of non-existent Action.
*/
public void removeActionAt(int index) {

int childCount = mActionsView.getChildCount();
//no-op in case of removal of non-existent Action.
if(index < 0 || childCount < 1)
return;

mActionsView.removeViewAt(index);
}

I'm the first timer on github and so don't know the exact process to put the fix.

could you analyze the above fix and see whether it qualifies as a minor fix?