Skip to content

Commit 605531d

Browse files
authored
maybe this will fix it then
1 parent 9a6a429 commit 605531d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

js/tracker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ function addPosition(position) {
22812281
// calculate vertical rate
22822282
if (dtt > 10) {
22832283
var rate = (position.gps_alt - vehicle.curr_position.gps_alt) / dt;
2284-
if (!isNaN(rate) && dt != 0) {
2284+
if (!isNaN(rate) && isFinite(rate) && dt != 0) {
22852285
vehicle.ascent_rate = 0.7 * rate + 0.3 * vehicle.ascent_rate;
22862286
}
22872287
} else {
@@ -2294,7 +2294,7 @@ function addPosition(position) {
22942294
// calculate horizontal rate
22952295
if (dtt > 10) {
22962296
horizontal_rate_temp = new_latlng.distanceTo(new L.LatLng(vehicle.curr_position.gps_lat, vehicle.curr_position.gps_lon)) / dt;
2297-
if (!isNaN(horizontal_rate_temp) && dt != 0) {
2297+
if (!isNaN(horizontal_rate_temp) && isFinite(horizontal_rate_temp) && dt != 0) {
22982298
vehicle.horizontal_rate = horizontal_rate_temp;
22992299
}
23002300
} else {

0 commit comments

Comments
 (0)