johannilsson / android-actionbar

DEPRECATED Android Action Bar Implementation
1.31k stars 564 forks source link

Crash if press "Remove action" when no button in ActionBar #45

Open trietbui85 opened 12 years ago

trietbui85 commented 12 years ago

At first launch, I see there are 2 buttons in ActionBar. I try to press "Remove Action" many times (> 2 times) and get a crash.

I found maybe because of OutOfBound exception in actionBar.removeActionAt(actionCount - 1); removeAction.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { int actionCount = actionBar.getActionCount(); actionBar.removeActionAt(actionCount - 1); Toast.makeText(HomeActivity.this, "Removed action." , Toast.LENGTH_SHORT).show(); } }); You should check if there is any button in ActionBar before remove it.

Cheers, Btw, it's a great library. Thank your very much for your hard-working ;)