means that
optimism should be accompanied by practical preparation for unfavourable possibilities.
The saying “Hope for the best and prepare for the worst” can be used when one should be optimistic and expect the best, but also one should take precautions against adversities that might happen.