replace NaN by 0

This commit is contained in:
hpcwoess 2020-09-08 10:33:19 +02:00
parent 1e72349026
commit 70e2ec5672

View file

@ -66,6 +66,10 @@ function addPointsToTrack(track,body)
{ {
f = parseFloat(token.substring(0,10)); f = parseFloat(token.substring(0,10));
} }
if(isNaN(f))
{
f=0.0;
}
track.trackData.points[track.trackData.points.length - 1].latitude = f; track.trackData.points[track.trackData.points.length - 1].latitude = f;
num++; num++;
} }
@ -75,6 +79,10 @@ function addPointsToTrack(track,body)
{ {
f = parseFloat(token.substring(0,10)); f = parseFloat(token.substring(0,10));
} }
if(isNaN(f))
{
f=0.0;
}
track.trackData.points[track.trackData.points.length - 1].longitude = f; track.trackData.points[track.trackData.points.length - 1].longitude = f;
num++; num++;
} }
@ -84,6 +92,10 @@ function addPointsToTrack(track,body)
{ {
f = parseFloat(token.substring(0,10)); f = parseFloat(token.substring(0,10));
} }
if(isNaN(f))
{
f=0.0;
}
track.trackData.points[track.trackData.points.length - 1].course = f; track.trackData.points[track.trackData.points.length - 1].course = f;
num++; num++;
} }
@ -93,6 +105,10 @@ function addPointsToTrack(track,body)
{ {
f = parseFloat(token.substring(0,10)); f = parseFloat(token.substring(0,10));
} }
if(isNaN(f))
{
f=0.0;
}
track.trackData.points[track.trackData.points.length - 1].speed = f; track.trackData.points[track.trackData.points.length - 1].speed = f;
num++; num++;
} }