Just had an issue whereby a publication apparently had Metadata, but not an assigned MetadataSchema. This then gave an NPE here: https://github.com/sdl/dxa-content-management/blob/develop/Sdl.Web.Tridion.Templates/Templates/PublishConfiguration.cs#L277 and further a startPublication.MetadataSchema is null.
So, I think an extra check on the nullness of MetadataSchema on startPublication is needed.