As Bob mentions, your buttonID could be any value not within the index range of the array [0:3]. As you set your loop. for(i = 0; i < 4; i++) and check button*, if you detect the button having been pressed set the buttonID to i.*
After the loop switch(buttonID) case 0 to case 3 with functions that deal with each button and default to deal with the no_button_pressed scenario.