mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-03 09:39:38 +00:00
fixing NPE in mark passing calculator when leg bearing is unknown
This commit is contained in:
1 parent
b3970a8007
commit
18af8fc20c
1 file changed
+20
-14
+20
-14
@@ -1481,24 +1481,30 @@ public class CandidateFinderImpl implements CandidateFinder {
|
|||||||
// passing instructions. If no passing instructions are given, construct two lines, one to each direction
|
// passing instructions. If no passing instructions are given, construct two lines, one to each direction
|
||||||
// orthogonally to the adjacent leg:
|
// orthogonally to the adjacent leg:
|
||||||
if (w == race.getRace().getCourse().getFirstWaypoint()) {
|
if (w == race.getRace().getCourse().getFirstWaypoint()) {
|
||||||
if (instruction == PassingInstruction.None || instruction == PassingInstruction.Single_Unknown) {
|
final Bearing legBearingStartingAtW = markPositionCache.getLegBearing(race.getTrackedLegStartingAt(w));
|
||||||
b = markPositionCache.getLegBearing(race.getTrackedLegStartingAt(w)).add(new DegreeBearingImpl(90));
|
if (legBearingStartingAtW != null) {
|
||||||
result.add(new Pair<>(p, b));
|
if (instruction == PassingInstruction.None || instruction == PassingInstruction.Single_Unknown) {
|
||||||
b = markPositionCache.getLegBearing(race.getTrackedLegStartingAt(w)).add(new DegreeBearingImpl(270));
|
b = legBearingStartingAtW.add(new DegreeBearingImpl(90));
|
||||||
} else {
|
result.add(new Pair<>(p, b));
|
||||||
b = markPositionCache.getLegBearing(race.getTrackedLegStartingAt(w)).add(new DegreeBearingImpl(instruction == PassingInstruction.Port ? 90 : 270));
|
b = legBearingStartingAtW.add(new DegreeBearingImpl(270));
|
||||||
|
} else {
|
||||||
|
b = legBearingStartingAtW.add(new DegreeBearingImpl(instruction == PassingInstruction.Port ? 90 : 270));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (w == race.getRace().getCourse().getLastWaypoint()) {
|
} else if (w == race.getRace().getCourse().getLastWaypoint()) {
|
||||||
if (instruction == PassingInstruction.None || instruction == PassingInstruction.Single_Unknown) {
|
final Bearing legBearingFinishingAtW = markPositionCache.getLegBearing(race.getTrackedLegFinishingAt(w));
|
||||||
b = markPositionCache.getLegBearing(race.getTrackedLegFinishingAt(w)).add(new DegreeBearingImpl(90));
|
if (legBearingFinishingAtW != null) {
|
||||||
result.add(new Pair<>(p, b));
|
if (instruction == PassingInstruction.None || instruction == PassingInstruction.Single_Unknown) {
|
||||||
b = markPositionCache.getLegBearing(race.getTrackedLegFinishingAt(w)).add(new DegreeBearingImpl(270));
|
b = legBearingFinishingAtW.add(new DegreeBearingImpl(90));
|
||||||
} else {
|
result.add(new Pair<>(p, b));
|
||||||
b = markPositionCache.getLegBearing(race.getTrackedLegFinishingAt(w)).add(new DegreeBearingImpl(instruction == PassingInstruction.Port ? 90 : 270));
|
b = legBearingFinishingAtW.add(new DegreeBearingImpl(270));
|
||||||
|
} else {
|
||||||
|
b = legBearingFinishingAtW.add(new DegreeBearingImpl(instruction == PassingInstruction.Port ? 90 : 270));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Bearing before = markPositionCache.getLegBearing(race.getTrackedLegFinishingAt(w));
|
final Bearing before = markPositionCache.getLegBearing(race.getTrackedLegFinishingAt(w));
|
||||||
Bearing after = markPositionCache.getLegBearing(race.getTrackedLegStartingAt(w));
|
final Bearing after = markPositionCache.getLegBearing(race.getTrackedLegStartingAt(w));
|
||||||
if (before != null && after != null) {
|
if (before != null && after != null) {
|
||||||
b = before.middle(after.reverse());
|
b = before.middle(after.reverse());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user