Skip to content

Commit

Permalink
Remove potential null exception (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
k3ldar authored Aug 30, 2023
1 parent d8b5a1a commit 8eea584
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public IActionResult DownloadView(int id)
}

[HttpPost]
public FileStreamResult DownloadFile(ViewDownloadViewItem model)
public IActionResult DownloadFile(ViewDownloadViewItem model)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
Expand All @@ -122,7 +122,10 @@ public FileStreamResult DownloadFile(ViewDownloadViewItem model)
if (downloadItem != null)
break;
}


if (downloadItem == null)
return RedirectToAction(nameof(Index));

string path = downloadItem.Filename;
string name = Path.GetFileName(path);
string ext = Path.GetExtension(path) ?? String.Empty;
Expand Down

0 comments on commit 8eea584

Please sign in to comment.