@@ -362,18 +362,26 @@ void CDynamicPositionRequestor::RunL()
362
362
else
363
363
{
364
364
LOG (_L8 (" Max speed=%f m/s" ), speed);
365
- TReal time;
366
- TInt err = Math::Round (time, KDistanceBetweenPoints / speed, 0 ); // Round to seconds
367
- // to prevent too often positioner options updated
368
- if (err != KErrNone)
369
- LOG (_L8 (" Time Round error" ));
370
- User::LeaveIfError (err);
371
-
372
- updateInterval = TTimeIntervalMicroSeconds (time * KSecond);
373
- // Use range restrictions
374
- updateInterval = Min (
375
- Max (updateInterval, KPositionMinUpdateInterval),
376
- KPositionMaxUpdateInterval);
365
+ TReal time = KDistanceBetweenPoints / speed;
366
+ if (Math::IsFinite (time)) // i.e. speed > 0
367
+ {
368
+ TInt err = Math::Round (time, time, 0 ); // Round to seconds
369
+ // to prevent too often positioner options updated
370
+ if (err != KErrNone)
371
+ LOG (_L8 (" Time Round error" ));
372
+ User::LeaveIfError (err);
373
+
374
+ updateInterval = TTimeIntervalMicroSeconds (time * KSecond);
375
+ // Use range restrictions
376
+ updateInterval = Min (
377
+ Max (updateInterval, KPositionMinUpdateInterval),
378
+ KPositionMaxUpdateInterval);
379
+ }
380
+ else
381
+ {
382
+ LOG (_L8 (" Error calculating position update time - set it to max value" ));
383
+ updateInterval = KPositionMaxUpdateInterval;
384
+ }
377
385
}
378
386
379
387
if (updateInterval != iUpdateOptions.UpdateInterval ())
0 commit comments