+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Ecommerce Bug: CatalogManager.GetProduct(sku) throw NullReferenceException if SKU does not exist

Ecommerce Bug: CatalogManager.GetProduct(sku) throw NullReferenceException if SKU does not exist

1 posts, 0 answered
  1. SteveV
    SteveV avatar
    178 posts
    Registered:
    06 Nov 2011
    29 Aug 2012
    Link to this post

    Calling the GetProduct method using an invalid product SKU throws a NullReferenceException rather than returning a null Product.

    How to reproduce:

    string badSKU = "0000-0000";
    var catManager = CatalogManager.GetManager();
    Product product = catManager.GetProduct(badSKU);

    It's easy enough to work around using a try/catch block but if this is by design, it might be more appropriate to throw a more descriptive exception.

    --Steve

1 posts, 0 answered