Merged code part preventing error cookie check

When there are no cookies at all, the check can throw a null pointer, this fix prevents that...