WallDrawer.java fixed. Looks like asking a null reference's name is not a

good idea.
This commit is contained in:
ericnerdo 2016-05-07 23:24:51 +02:00
parent e63a62893e
commit f241695413

View File

@ -14,26 +14,29 @@ public class WallDrawer extends ImagePanel implements Drawer {
@Override
public void draw() throws IOException {
switch(wall.getStargate().getName()){
case "Blue Stargate":
changeImage("BlueStargate.png");
break;
case "Yellow Stargate":
changeImage("YellowStargate.png");
break;
case "Red Stargate":
changeImage("RedStargate.png");
break;
case "GreenStargate":
changeImage("GreenStargate.png");
break;
default:
changeImage("Wall.png");
break;
}
setVisible(true);
if(wall.getStargate() == null)
changeImage("Wall.png");
else{
switch(wall.getStargate().getName()){
case "Blue Stargate":
changeImage("BlueStargate.png");
break;
case "Yellow Stargate":
changeImage("YellowStargate.png");
break;
case "Red Stargate":
changeImage("RedStargate.png");
break;
case "Green Stargate":
changeImage("GreenStargate.png");
break;
default:
changeImage("Wall.png");
break;
}
}
setVisible(true);
}
@Override