train_cmd.c
changeset 1921 263f1bcfc038
parent 1917 74cab7e464d1
child 1922 797081e56d13
--- a/train_cmd.c	Mon Jun 06 19:18:40 2005 +0000
+++ b/train_cmd.c	Mon Jun 06 21:32:04 2005 +0000
@@ -845,6 +845,9 @@
 				src_head = NULL;
 			}
 		} else {
+			// if moving within the same chain, dont use dst_head as it may get invalidated
+			if (src_head == dst_head)
+				dst_head = NULL;
 			// unlink single wagon from linked list
 			src_head = UnlinkWagon(src, src_head);
 			src->next = NULL;