Fix #6598: Added company id check for connect console command. #8346
LordAro left a comment
An excellent patch, I believe this solves the issue well.
I am confused about what the numbers are doing though. The reconnect command above is explicitly +1 (whereas normally they're 0 indexed), but the helptext for all join/move/reconnect implies that they are 1-indexed, though it's rather hit and miss whether they're doing +1 to the company id or not. Probably needs checking all of them to make sure you can actually join as the first and last company. Error messages would need adjusting, certainly (
I'd just like to point out that the original issue includes reports of the game crash, invalid game state and ai crash. And while adding preliminary id check in the command is alright it doesn't really change much as that company id is actually used much later and can become invalid. So it can't really be considered a definite fix for any of the aforementioned issues. At least not without a good explanation of what causes that and why.