From a03bcc835e80e8799f560b6b824eb32e1154b5c3 Mon Sep 17 00:00:00 2001 From: Reinder Feenstra Date: Sun, 24 Sep 2023 23:01:17 +0200 Subject: [PATCH] fix: a train without vehicles can't be activated --- server/src/train/train.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/train/train.cpp b/server/src/train/train.cpp index 0bd18575..b6d03f48 100644 --- a/server/src/train/train.cpp +++ b/server/src/train/train.cpp @@ -376,6 +376,11 @@ bool Train::setTrainActive(bool val) if(val) { + if(vehicles->empty()) + { + return false; // activating a train without vehicles is useless. + } + //To activate a train, ensure all vehicles are stopped and free for(const auto& vehicle : *vehicles) {