diff --git a/cicaprojekt/WallDrawer.java b/cicaprojekt/WallDrawer.java index 4eeeeb0..cf4a8bd 100644 --- a/cicaprojekt/WallDrawer.java +++ b/cicaprojekt/WallDrawer.java @@ -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