From 2c2f483126121e7bf06909759459abc087584249 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 11 Jan 2022 14:23:24 +0000 Subject: [PATCH] Prevent NPE when viewing non-rendered files 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 d45df012e1593..855d7866a3597 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}}