Looks like that could only happen if there were no certificates on the system at all, which is exceedingly rare. Someone would have to change the GUI to HTTP (dangerous enough as it is) and also delete the default GUI certificate.
The code could handle that better, but it's still not something anyone should be hitting.
You could make a certificate for now to work around it, either manually or by generating a GUI cert with pfSsh,php playback generateguicert from an SSH or console shell prompt.