added safety check before retrieving product details. Fixed a bug that made server crash when an invalid product was requested.