Fails safely if no overlay nor theme is available. Fixes #853.

Please review.