Noticed by Feldfeld nani and myself in an svn match on jebel barkal the entPanelbuttons placement can error out. This happens we there are 20 or more panelEnts (13 relics and 8 heroes in this case) and one of the heroes is killed and afterwards a new hero is created (we were in observer mode, players didn't notice). The placement code tries to reuse old slots but the heroes are always displayed before the relics so it when the new hero is trained all buttons are filled, but we want to add a new icon, but we can't find a free index, thus finding a nonexisting gui index errors out.
Fixing it by only trying to keep actually displayed buttons on the same index.