mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-15 06:49:56 +00:00
Added null checks as value returned by JSON might be empty
This commit is contained in:
1 parent
ed02abf33a
commit
770b65da3a
1 file changed
+6
-3
+6
-3
@@ -82,9 +82,12 @@ public class CompetitorJsonDeserializer implements JsonDeserializer<DynamicCompe
|
||||
CompetitorJsonConstants.FIELD_TEAM));
|
||||
}
|
||||
final DynamicBoat boat = getBoat(object, /* default ID */ competitorId);
|
||||
final Double timeOnTimeFactor = ((Number) object.get(CompetitorJsonConstants.FIELD_TIME_ON_TIME_FACTOR)).doubleValue();
|
||||
final Double timeOnDistanceAllowanceInSecondsPerNauticalMile = ((Number) object
|
||||
.get(CompetitorJsonConstants.FIELD_TIME_ON_DISTANCE_ALLOWANCE_IN_SECONDS_PER_NAUTICAL_MILE)).doubleValue();
|
||||
final Number timeOnTimeFactorAsNumber = (Number) object.get(CompetitorJsonConstants.FIELD_TIME_ON_TIME_FACTOR);
|
||||
final Double timeOnTimeFactor = timeOnTimeFactorAsNumber != null ? timeOnTimeFactorAsNumber.doubleValue() : 0.0;
|
||||
final Number timeOnDistanceAllowanceInSecondsPerNauticalMileAsNumber = (Number) object
|
||||
.get(CompetitorJsonConstants.FIELD_TIME_ON_DISTANCE_ALLOWANCE_IN_SECONDS_PER_NAUTICAL_MILE);
|
||||
final Double timeOnDistanceAllowanceInSecondsPerNauticalMile = timeOnDistanceAllowanceInSecondsPerNauticalMileAsNumber != null ?
|
||||
timeOnDistanceAllowanceInSecondsPerNauticalMileAsNumber.doubleValue() : 0.0;
|
||||
final DynamicCompetitor result;
|
||||
if (boat == null) {
|
||||
result = competitorWithBoatFactory.getOrCreateCompetitor(competitorId, name, shortName, displayColor, email,
|
||||
|
||||
Reference in new issue
Block a user