Fix crash if auto detect language on checkout page, and the language couldn't be detected (Fix #4881) (#4888)

This commit is contained in:
Nicolas Dorier 2023-04-17 10:53:45 +09:00 committed by GitHub
parent 8e60932f81
commit b0c1b0895d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -754,7 +754,7 @@ namespace BTCPayServer.Controllers
{
case "auto":
case null when storeBlob.AutoDetectLanguage:
lang = _languageService.AutoDetectLanguageUsingHeader(HttpContext.Request.Headers, null).Code;
lang = _languageService.AutoDetectLanguageUsingHeader(HttpContext.Request.Headers, null)?.Code;
break;
case { } langs when !string.IsNullOrEmpty(langs):
{

View file

@ -167,7 +167,7 @@
<div class="form-check">
<input asp-for="AutoDetectLanguage" type="checkbox" class="form-check-input" />
<label asp-for="AutoDetectLanguage" class="form-check-label"></label>
<div class="form-text">Detects the language of the customer's browser with 99.9% accuracy.</div>
<div class="form-text">Detects the language of the customer's browser.</div>
</div>
</div>
<div class="form-group">