Temporary patch for #3123

This should fix the crash, but I haven't thought about the implications for the way TradeShips works. There should be better ways of solving the problem, but I don't have time to think about or implement them right now.