From f9f1329cda753a6507ad51bd9e29df28bb83a769 Mon Sep 17 00:00:00 2001 From: Samuel Dumont Date: Sun, 16 May 2021 19:12:57 +0200 Subject: [PATCH] Fix the bug for 'outside workout' when keeping the last target (#32) Co-authored-by: Samuel Dumont --- source/RunPowerWorkoutView.mc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/RunPowerWorkoutView.mc b/source/RunPowerWorkoutView.mc index ae4f84a..cdb554b 100644 --- a/source/RunPowerWorkoutView.mc +++ b/source/RunPowerWorkoutView.mc @@ -548,13 +548,12 @@ class RunPowerWorkoutView extends WatchUi.DataField { } } } else { - if(!keepLast){ + if(!keepLast || nextTargetHigh == null || nextTargetLow == null){ nextTargetHigh = 0; nextTargetLow = 0; } nextTargetType = 5; nextTargetDuration = 0; - } targetHigh = workout.step.targetValueHigh - 1000; @@ -603,7 +602,7 @@ class RunPowerWorkoutView extends WatchUi.DataField { } } } else { - if(keepLast){ + if(keepLast && nextTargetLow != null && nextTargetHigh != null){ stepType = 5; targetHigh = nextTargetHigh; targetLow = nextTargetLow;