From 70e2ec56726b6bdd90ca1837b02a6e8f8e6e9e14 Mon Sep 17 00:00:00 2001 From: hpcwoess Date: Tue, 8 Sep 2020 10:33:19 +0200 Subject: [PATCH] replace NaN by 0 --- routes/api/tracks.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/routes/api/tracks.js b/routes/api/tracks.js index 71ae71f..5a835e1 100644 --- a/routes/api/tracks.js +++ b/routes/api/tracks.js @@ -66,6 +66,10 @@ function addPointsToTrack(track,body) { f = parseFloat(token.substring(0,10)); } + if(isNaN(f)) + { + f=0.0; + } track.trackData.points[track.trackData.points.length - 1].latitude = f; num++; } @@ -75,6 +79,10 @@ function addPointsToTrack(track,body) { f = parseFloat(token.substring(0,10)); } + if(isNaN(f)) + { + f=0.0; + } track.trackData.points[track.trackData.points.length - 1].longitude = f; num++; } @@ -84,6 +92,10 @@ function addPointsToTrack(track,body) { f = parseFloat(token.substring(0,10)); } + if(isNaN(f)) + { + f=0.0; + } track.trackData.points[track.trackData.points.length - 1].course = f; num++; } @@ -93,6 +105,10 @@ function addPointsToTrack(track,body) { f = parseFloat(token.substring(0,10)); } + if(isNaN(f)) + { + f=0.0; + } track.trackData.points[track.trackData.points.length - 1].speed = f; num++; }