Check if 'certificate' is preset before checking length
Merge pull request #1100 from kppullin/certExceptionMonoFix

Check if 'certificate' is present before checking length