We study a portfolio optimization problem in a market which is under the threat of crashes. At random times, the investor receives a warning that a crash in the risky asset might occur. We construct a strategy which renders the investor indifferent about an immediate crash of maximum size and no crash at all. We then verify that this strategy outperforms every other trading strategy using a direct comparison approach. We conclude with numerical examples and calculating the costs of hedging against crashes. (C) 2014 Elsevier B.V. All rights reserved.