From 09d2029b6c943e542ae5ddf0a5b890ab92355b0f Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 11 Jan 2022 17:18:52 +0000 Subject: [PATCH] Prevent NPE when viewing non-rendered files (#18234) Fix #18231 Signed-off-by: Andrew Thornton --- templates/repo/unicode_escape_prompt.tmpl | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl index d45df012e15..855d7866a35 100644 --- a/templates/repo/unicode_escape_prompt.tmpl +++ b/templates/repo/unicode_escape_prompt.tmpl @@ -1,17 +1,19 @@ -{{if .EscapeStatus.BadBIDI}} -
- {{svg "octicon-x" 16 "close inside"}} -
- {{$.root.i18n.Tr "repo.bidi_bad_header"}} -
-

{{$.root.i18n.Tr "repo.bidi_bad_description" | Str2html}}

-
-{{else if .EscapeStatus.Escaped}} -
- {{svg "octicon-x" 16 "close inside"}} -
- {{$.root.i18n.Tr "repo.unicode_header"}} -
-

{{$.root.i18n.Tr "repo.unicode_description" | Str2html}}

-
+{{if .EscapeStatus}} + {{if .EscapeStatus.BadBIDI}} +
+ {{svg "octicon-x" 16 "close inside"}} +
+ {{$.root.i18n.Tr "repo.bidi_bad_header"}} +
+

{{$.root.i18n.Tr "repo.bidi_bad_description" | Str2html}}

+
+ {{else if .EscapeStatus.Escaped}} +
+ {{svg "octicon-x" 16 "close inside"}} +
+ {{$.root.i18n.Tr "repo.unicode_header"}} +
+

{{$.root.i18n.Tr "repo.unicode_description" | Str2html}}

+
+ {{end}} {{end}}