return null for getDuration with a null parameter

This commit is contained in:
Axel Uhl committed 2015-12-01 23:08:21 +01:00
1 parent cff08e107d
commit c256c328cf
1 file changed
+1 -1
@@ -21,7 +21,7 @@ public abstract class AbstractSpeedImpl implements Speed {
@Override
public Duration getDuration(Distance distance) {
return new MillisecondsDurationImpl((long) (1000 * distance.getMeters() / getMetersPerSecond()));
return distance == null ? null : new MillisecondsDurationImpl((long) (1000 * distance.getMeters() / getMetersPerSecond()));
}
@Override