Index: src/economy.cpp =================================================================== --- src/economy.cpp (revision 21952) +++ src/economy.cpp (working copy) @@ -520,8 +520,18 @@ break; } + /* When we check for bankruptcy we are not in a command. Given we are + * going to revert the current company later on we must be really sure + * that we won't leave current company as the bankrupted company. As + * such we just make sure it's not a valid company at all; that also + * proves that we are not in a command. */ + assert(!Company::IsValidID(_current_company)); + Backup cur_company(_current_company, c->index, FILE_LINE); + /* Actually remove the company. */ DoCommand(0, 2 | (c->index << 16), 0, DC_EXEC, CMD_COMPANY_CTRL); + + cur_company.Restore(); break; } }