The only way fname wouldn't have a value if is if you passed a null value to the method (fname is the single String parameter passed to it), so I don't think that's the problem.
What exactly are you trying to do here? That particular line of code is encased in a try/catch so you shouldn't be getting an object reference error on your site. I'll assume you are debugging in Visual Studio. Just breakpoint that line and see which part of it is null. My guess is that you are trying to use SafeMapPath from a custom page somewhere and are doing so before the HttpContext is available or from a page where the HttpContext will never be available, hence the HttpContext is null.
<a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>