proverb

All is not lost that is in peril.

hope

means that

There is still hope, that a danger situation will end favorably or successfully.