Fixed mindSlaveMaster == controller causing StackoverflowError

This commit is contained in:
Hans Mackowiak
2020-11-30 11:59:19 +01:00
parent e2227f53f1
commit a3ec4817a2
3 changed files with 8 additions and 6 deletions

View File

@@ -37,13 +37,17 @@ public class GameEntityViewMap<Entity extends GameEntity, View extends GameEntit
}
}
public void addToList(Iterable<View> views, List<Entity> list) {
public List<Entity> addToList(Iterable<View> views, List<Entity> list) {
if (views == null) {
return list;
}
for (View view : views) {
Entity entity = get(view);
if (entity != null) {
list.add(entity);
}
}
return list;
}
public TrackableCollection<View> getTrackableKeys() {

View File

@@ -449,7 +449,7 @@ public class CardView extends GameEntityView {
//if viewer is controlled by another player, also check if card can be shown to that player
PlayerView mindSlaveMaster = controller.getMindSlaveMaster();
if (mindSlaveMaster != null && mindSlaveMaster == viewer) {
if (mindSlaveMaster != null && mindSlaveMaster != controller && mindSlaveMaster == viewer) {
return canBeShownTo(controller);
}
return false;