Ok, I didn't get any crashes, but I think it's close enough. Thing is connect cmd sometimes leaves the game in a weird half-disconnected state. It's not very noticable at first but it's clearly not a valid state. E.g. you can build rails but can't leave company or use join command. Or you can bring up mp lobby while still being in game.
There are several ways to get in that state:
1) connect ::1#254 (or anything 16-254)
2) connect ::1#1 and cancelling password prompt (company 1 has to be passworded)
3) connect ::1:0

I think I got all such cases in my patch but can't be 100% sure.
Also rearranged console output a bit so it doesn't say "connecting ..." before failing on arg parsing.
And added check for negative company # to prevent possible bugs with it.