summaryrefslogtreecommitdiff
path: root/nmea_parse.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-05-20 06:59:31 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-05-20 06:59:31 +0000
commitc5dee64de02c9f47674f64dc08c9e11a7c678522 (patch)
tree28c73bebaa0e2b77fcd87c56350e3bae2a19aa7c /nmea_parse.c
parent9b1e0a8887257d18609b911f2470fee04c016d02 (diff)
downloadgpsd-c5dee64de02c9f47674f64dc08c9e11a7c678522.tar.gz
Avoid potential divide-by-zero error.
Diffstat (limited to 'nmea_parse.c')
-rw-r--r--nmea_parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/nmea_parse.c b/nmea_parse.c
index 7c29efd0..ba6a56c8 100644
--- a/nmea_parse.c
+++ b/nmea_parse.c
@@ -274,7 +274,7 @@ static int processGPGGA(int c UNUSED, char *field[], struct gps_data_t *out)
* SiRF and Garmin chips, which might have some smoothing
* going on.
*/
- if (oldaltitude == ALTITUDE_NOT_VALID)
+ if (oldaltitude == ALTITUDE_NOT_VALID || out->fix.time==oldfixtime)
out->fix.climb = 0;
else {
out->fix.climb = (out->fix.altitude-oldaltitude)/(out->fix.time-oldfixtime);