From b65d99aa2c816b6dea3ecb6dd824ce02f7519fe2 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Wed, 10 Feb 2021 21:41:05 +0100 Subject: Don't try to invalidate_ahead when path has been regularily invalidated before --- advtrains/path.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'advtrains') diff --git a/advtrains/path.lua b/advtrains/path.lua index 7226a7b..714781a 100644 --- a/advtrains/path.lua +++ b/advtrains/path.lua @@ -142,6 +142,10 @@ end -- Keeps the path intact, but invalidates all path nodes from the specified index (inclusive) -- onwards. This has the advantage that we don't need to recalculate the whole path, and we can do it synchronously. function advtrains.path_invalidate_ahead(train, start_idx, ignore_when_passed) + if not train.path then + -- the path wasn't even initialized. Nothing to do + return + end local idx = atfloor(start_idx) --atdebug("Invalidate_ahead:",train.id,"start_index",start_idx,"cur_idx",train.index) -- cgit v1.2.3