Prevent empty public projects from throwing exceptions

To reproduce the bug prior to this patch, create an empty repository, make it public, and visit it from the public projects page, it should take you to the 500 error page.