From 6627c7a16a8f30b8c0219eea0ad86dc9fbaeb263 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 12 Mar 2024 08:25:01 +0100 Subject: [PATCH] refs #6913 routeKm --- modules/route/back/models/route.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js index 3505609d1..bf1f26e74 100644 --- a/modules/route/back/models/route.js +++ b/modules/route/back/models/route.js @@ -30,9 +30,11 @@ module.exports = Self => { }); function validateDistance(err) { - const routeTotalKm = this.kmEnd - this.kmStart; - const routeMaxKm = 4000; - if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) - err(); + if (this.kmEnd) { + const routeTotalKm = this.kmEnd - this.kmStart; + const routeMaxKm = 4000; + if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) + err(); + } } }; -- 2.40.1