diff --git a/VotersBallot.png b/VotersBallot.png index cc84024..535519f 100644 Binary files a/VotersBallot.png and b/VotersBallot.png differ diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java index 3dd9b48..ee569e2 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/managment/VotersBallot.java @@ -22,6 +22,9 @@ public class VotersBallot { * @return String */ public String GetCandidateName(){ + if (this.VotersImageSelection == null || this.VotersImageSelection.getDescription() == null ){ + return null; + } String[] name = this.VotersImageSelection.getDescription().split(" "); return name[0] + " " + name[1]; } diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java index cdd1f0a..1c6bf02 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/panels/ballot_summary/VotersChoicesAdder.java @@ -46,13 +46,18 @@ class VotersChoicesAdder { */ void ShowVotersChoices() throws IOException { this.RemoveAllAnswers(); - this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel)); - this.addAnswer(this.getNameChoice(this.votersBallot.GetCandidateName())); - this.addAnswer(this.getImageChoice(this.votersBallot.VotersImageSelection.getAnswer())); - this.addAnswer(this.getImageDescription(this.votersBallot.VotersImageSelection.getDescription())); - Label error = new Label(); - error.setPrefSize(250,30); - this.addAnswer(error); + if (this.votersBallot != null) { + this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel)); + this.addAnswer(this.getNameChoice(this.votersBallot.GetCandidateName())); + + if (this.votersBallot.VotersImageSelection != null) { + this.addAnswer(this.getImageChoice(this.votersBallot.VotersImageSelection.getAnswer())); + this.addAnswer(this.getImageDescription(this.votersBallot.VotersImageSelection.getDescription())); + } + Label error = new Label(); + error.setPrefSize(250, 30); + this.addAnswer(error); + } this.logger.debug("Add all the choises of the voter to the represent grid pane."); } diff --git a/voting-booth-gui/src/main/resources/view/ballot_summary.fxml b/voting-booth-gui/src/main/resources/view/ballot_summary.fxml index 5f6c9fe..811400b 100644 --- a/voting-booth-gui/src/main/resources/view/ballot_summary.fxml +++ b/voting-booth-gui/src/main/resources/view/ballot_summary.fxml @@ -78,11 +78,11 @@ - + - - + + @@ -116,17 +116,17 @@ - - - + + + - - - + + + - +
@@ -137,11 +137,11 @@ - + - + - +