Skip to content

Commit

Permalink
fix null pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Krusche committed Feb 3, 2019
1 parent 779da56 commit e68fdfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ private void changeStatisticBasedOnResult(SubmittedAnswer submittedAnswer, boole
shortAnswerSubmittedText = shortAnswerSubmittedAnswer.getSubmittedTextForSpot(spotCounter.getSpot());
shortAnswerSolutions = spotCounter.getSpot().getQuestion().getCorrectSolutionForSpot(spotCounter.getSpot());

for(ShortAnswerSolution solution : shortAnswerSolutions){
if(shortAnswerSubmittedText.isSubmittedTextCorrect(shortAnswerSubmittedText.getText(), solution.getText()) && shortAnswerSubmittedText.isIsCorrect()){
if (shortAnswerSubmittedText == null) {
continue;
}
for(ShortAnswerSolution solution : shortAnswerSolutions) {
if(shortAnswerSubmittedText.isSubmittedTextCorrect(shortAnswerSubmittedText.getText(), solution.getText()) && Boolean.TRUE == shortAnswerSubmittedText.isIsCorrect()){
spotCounter.setUnRatedCounter(spotCounter.getUnRatedCounter() + change);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public boolean submittedTextMoreThanOnceInSubmittedAnswer(ShortAnswerSubmittedTe
}

public ShortAnswerSubmittedText getSubmittedTextForSpot(ShortAnswerSpot spot) {
for(ShortAnswerSubmittedText submittedText : this.getSubmittedTexts()){
for(ShortAnswerSubmittedText submittedText : this.getSubmittedTexts()) {
if(submittedText.getSpot().equals(spot)) {
return submittedText;
}
Expand Down

0 comments on commit e68fdfa

Please sign in to comment.