ArgumentNullException thrown from IContentHandler

Topics: Customizing Orchard
Mar 10, 2014 at 7:49 PM
Here's a snippet from my error log.
2014-03-10 15:40:40,401 [5] Orchard.ContentManagement.DefaultContentDisplay - Default - ArgumentNullException thrown from IContentHandler by Folkways.Collection.Handlers.AlbumPartHandler
System.ArgumentNullException: Value cannot be null.
Parameter name: source
The offending code uses .Any() to conditionally step over NULL values. It looks like so:
    private void RegisterCatalogNumberMeta(BuildDisplayContext context, AlbumPart part) {
        if (!part.CatalogNumber.Any())

        _resourceManager.SetMeta(new MetaEntry {
            Name = "CatalogNumber",
            Content = part.CatalogNumber
Being a bit of a rook, I can't for the life of me figure out why I'm getting a NULL error. The value itself is nullable but in this context errors abound. Is there a more appropriate way to query for null values here?

Mar 11, 2014 at 4:32 PM
Thanks Sipke! Here's the fix in case others have a similar hiccup. To check for NULL on strings is different than for IEnumerables.
    private void RegisterImageUrlMeta(BuildDisplayContext context, AlbumPart part) {

        _resourceManager.SetMeta(new MetaEntry {
            Name = "ImageURL",
            Content = "/images/album_covers/SF110/" + part.CatalogNumber + ".jpg"