for (BaseCell c : cells) {
if (c != null && c.isAlive())
c.eat();
if (c.type == "AnimalCell"){
BaseCell a;
a = new PlantCell();
int k=c.getLocation();
a = BuscarLista(k);
a.setFoodLevel(a.getFoodLevel() - 1);
a.doStarvation();
}
}
Hi, Sometimes when I run this code, gives me this error:
Exception in thread "main" java.lang.NullPointerException
at Sim.run(Sim.java:117)
at Sim.main(Sim.java:175)
It usually happens 1 in 5 times I run. I donīt know which is the problem.

