I have tabs(checkboxes in one group) and tab content panels. Each tab is check box that controls its panel by activating and deactivating it. On one tab content panel I again have few checkboxes, so when I deactivate it, this checkboxes are deactivated.
So I open this window and see tabs buttons, for example first tab is checked. On its content there are another checkboxes. When I hit second tab, first tab is deactivated, and it automatically deactivates its content (with checkboxes). At this point I get NPE at line 180 of UIToggle.cs, cb is null
// Uncheck all other toggles
if (group != 0 && state)
{
for (int i = 0, imax = list.size; i < imax; ++i)
{
UIToggle cb = list[i];
if (cb != this && cb.group == group) cb.Set(false);
}
}
this happens that for example in first iteration of loop, we deactivated some other checkboxes via
cb.Set(false), and they are not in list already. But
imaxthat you calculated before iterating the list contains old value, so when I access element beyond the list it returns null and that is why
cb can be null.