Fix crash when we don't have any cookies

Fixes #1688