mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 13:33:59 +00:00
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:
1 parent
ee8ab1e097
commit
473800645c
2 files changed
+17
-15
No files matched your search
+9
-7
@@ -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
|
||||
|
||||
+8
-8
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user