Vector layers = getLayers(); if (layers.size() > layerIndex && tabs != null) {  tabs.setSelectedIndex(layerIndex + 1); }
Vector layers = getLayers(); if (layers.size() > layerIndex && tabs != null && layerIndex < tabs.getTabCount()) {  tabs.setSelectedIndex(layerIndex + 1); }
    protected void setPaletteTab(int layerIndex) {	Vector layers = getLayers();	if (layers.size() > layerIndex && tabs != null) {	    // +1 because the first tab is the ScaleFilterLayer tab	    tabs.setSelectedIndex(layerIndex + 1);	}    }