Hello everyone,

I think I have found a bug inside the "setGenomeLength" method of the
GeneVectorIndividual class. I am using individuals with random length
initialization and custom genes. When initialising the population, the
method "setGenomeLength" raises an ArrayIndexOutOfBounds exception. This
method's implementation is the following:

public void setGenomeLength(int len)
        GeneVectorSpecies s = (GeneVectorSpecies) species;
        VectorGene[] newGenome = new VectorGene[len];
        System.arraycopy(genome, 0, newGenome, 0,
            genome.length < newGenome.length ? genome.length : newGenome.length);
        for(int x=genome.length; x< newGenome.length; x++)
            if (genome[x]==null) genome[x] = (VectorGene)(s.genePrototype.clone());  // not reset
        genome = newGenome;

The line which raises the exception is:
	if (genome[x]==null) genome[x] = (VectorGene)(s.genePrototype.clone());  // not reset

I think that this line should be
	if (newGenome[x]==null) newGenome[x] = (VectorGene)(s.genePrototype.clone());

because after the for-loop newGenome is assigned to genome, and when entering the loop, genome.length is 1 so it always raises an exception.

Am I right?