Do not crash if /apps/{appId} do not exists

This commit is contained in:
nicolas.dorier 2022-04-29 16:00:03 +09:00
parent 9aa35f3488
commit f4823d962a
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -43,8 +43,10 @@ namespace BTCPayServer.Controllers
[HttpGet("/apps/{appId}")]
public async Task<IActionResult> RedirectToApp(string appId)
{
switch ((await _AppService.GetApp(appId, null)).AppType)
var app = await _AppService.GetApp(appId, null);
if (app is null)
return NotFound();
switch (app.AppType)
{
case nameof(AppType.Crowdfund):
return RedirectToAction("ViewCrowdfund", new { appId });