-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
Description
I've been working with Ashley 1.7.0 for a while and it's been running smooth. I just upgraded to 1.7.2 and now I am getting a NullPointer in the code below. When I get the FollowerComponent from an entity in the list of engine.getEntitiesFor(Family.all(FollowerComponent.class).get()), the FollowerCompnent is null.
This shouldn't be possible correct? All of the entities in the returned array should be guaranteed to have the component's required by the Family.
EntityListener el;
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
final Engine eg = engine;
if(el == null){
el = new EntityListener() {
private ComponentMapper<FollowerComponent> fm = ComponentMapper.getFor(FollowerComponent.class);
public void entityAdded(Entity entity) {
}
@Override
public void entityRemoved(Entity entity) {
for (Entity follower : eg.getEntitiesFor(Family.all(FollowerComponent.class).get())) {
FollowerComponent fc = fm.get(follower);
if (fc.target == entity) { ///<<<<------ error occurs here
fc.target = null;
follower.removeAll();
eg.removeEntity(follower);
}
}
}
};
}
engine.addEntityListener(Family.all(EnemyComponent.class).get(), el);
}Reactions are currently unavailable