diff --git a/src/Libraries/Nop.Services/Media/PictureService.cs b/src/Libraries/Nop.Services/Media/PictureService.cs index c23d0aa9eb6..d6fef1cbc16 100644 --- a/src/Libraries/Nop.Services/Media/PictureService.cs +++ b/src/Libraries/Nop.Services/Media/PictureService.cs @@ -173,7 +173,7 @@ protected virtual Task GetThumbLocalPathAsync(string thumbFileName) /// protected virtual Task GetImagesPathUrlAsync(string storeLocation = null) { - var pathBase = _httpContextAccessor.HttpContext.Request?.PathBase.Value ?? string.Empty; + var pathBase = _httpContextAccessor.HttpContext?.Request?.PathBase.Value ?? string.Empty; var imagesPathUrl = _mediaSettings.UseAbsoluteImagePath ? storeLocation : $"{pathBase}/"; imagesPathUrl = string.IsNullOrEmpty(imagesPathUrl) ? _webHelper.GetStoreLocation() : imagesPathUrl; imagesPathUrl += "images/"; @@ -1252,4 +1252,4 @@ public string GetPictureContentTypeByFileExtension(string fileExtension) } #endregion -} \ No newline at end of file +}