From 8a126906f36b4e3eaa49faec4d6726c6b82b0de3 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 28 Feb 2023 15:20:29 +0100 Subject: [PATCH] Only need do anything if cab existed --- DCC.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index abdee73..36d305d 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -576,9 +576,11 @@ void DCC::setLocoId(int id,ACK_CALLBACK callback) { void DCC::forgetLoco(int cab) { // removes any speed reminders for this loco setThrottle2(cab,1); // ESTOP this loco if still on track - int reg=lookupSpeedTable(cab); - if (reg>=0) speedTable[reg].loco=0; - setThrottle2(cab,1); // ESTOP if this loco still on track + int reg=lookupSpeedTable(cab, false); + if (reg>=0) { + speedTable[reg].loco=0; + setThrottle2(cab,1); // ESTOP if this loco still on track + } } void DCC::forgetAllLocos() { // removes all speed reminders setThrottle2(0,1); // ESTOP all locos still on track