a fix towards bug 3287: avoiding NPE for cases where a fixed mark passing is found in the race log for a competitor no longer part of the race

This commit is contained in:
Axel Uhl committed 2015-09-21 16:30:55 +02:00
1 parent ee8ab1e097
commit 473800645c
2 files changed
+17 -15

No files matched your search

@@ -133,14 +133,16 @@ public class CandidateChooserImpl implements CandidateChooser {
public void setFixedPassing(Competitor c, Integer zeroBasedIndexOfWaypoint, TimePoint t) {
Candidate fixedCan = new CandidateImpl(zeroBasedIndexOfWaypoint + 1, t, 1, Util.get(race.getRace().getCourse().getWaypoints(), zeroBasedIndexOfWaypoint));
NavigableSet<Candidate> fixed = fixedPassings.get(c);
if (!fixed.add(fixedCan)) {
Candidate old = fixed.ceiling(fixedCan);
fixed.remove(old);
removeCandidates(c, Arrays.asList(old));
fixed.add(fixedCan);
if (fixed != null) { // can only set the mark passing if the competitor is still part of this race
if (!fixed.add(fixedCan)) {
Candidate old = fixed.ceiling(fixedCan);
fixed.remove(old);
removeCandidates(c, Arrays.asList(old));
fixed.add(fixedCan);
}
addCandidates(c, Arrays.asList(fixedCan));
findShortestPath(c);
}
addCandidates(c, Arrays.asList(fixedCan));
findShortestPath(c);
}
@Override
@@ -301,14 +301,14 @@ public class EditMarkPassingsPanel extends AbsolutePanel implements Component<Ab
}
private void processCompetitorSelectionChange(boolean visible) {
waypointSelectionModel.clear();
if (visible && Util.size(competitorSelectionModel.getSelectedCompetitors()) == 1) {
selectCompetitorLabel.setText("");
refillList();
} else {
disableEditing();
selectCompetitorLabel.setText(stringMessages.selectCompetitor());
}
waypointSelectionModel.clear();
if (visible && Util.size(competitorSelectionModel.getSelectedCompetitors()) == 1) {
selectCompetitorLabel.setText("");
refillList();
} else {
disableEditing();
selectCompetitorLabel.setText(stringMessages.selectCompetitor());
}
}
private void disableEditing() {