selectTab - checks for illegal index value

Don't send illegal index value to object list and
cause exception, just output error to console instead
This commit is contained in:
Timo Taipalus 2016-03-09 14:16:22 +02:00
parent b06d485d12
commit 0f0ac6a527
1 changed files with 4 additions and 0 deletions

View File

@ -557,6 +557,10 @@ class TabControl : WidgetGroupDefaultDrawing {
}
void selectTab(int index, bool updateAccess) {
if (index < 0 || index + 1 >= _children.count) {
Log.e("Tried to access tab out of bounds (index = %d, count = %d)",index,_children.count-1);
return;
}
if (_children.get(index + 1).compareId(_selectedTabId))
return; // already selected
string previousSelectedTab = _selectedTabId;