Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Added null check before getting download binary in GetDownloadById (#264)

SUNIL PARISI04033eb1ceda
diff --git a/src/Business/Grand.Business.Storage/Services/DownloadService.cs b/src/Business/Grand.Business.Storage/Services/DownloadService.cs
index 68665c505..bf1ac6f70 100644
--- a/src/Business/Grand.Business.Storage/Services/DownloadService.cs
+++ b/src/Business/Grand.Business.Storage/Services/DownloadService.cs
@@ -51,7 +51,7 @@ namespace Grand.Business.Storage.Services
return null;
var _download = await _downloadRepository.GetByIdAsync(downloadId);
- if (!_download.UseDownloadUrl)
+ if (_download != null && !_download.UseDownloadUrl)
_download.DownloadBinary = await DownloadAsBytes(_download.DownloadObjectId);
return _download;