It seems silly to say, but maintain good friendships. When things go bad, or sideways you are only as good as your support network.
This requires your support in advance. This is not Machiavellian plotting, simply a reminder to treat people right in the present, offering yourself now, because it models the behavior of care we all wish for.