Skip to content

Commit

Permalink
Unfortunately go template if does not shortcut (go-gitea#11392)
Browse files Browse the repository at this point in the history
Go template's `{{if ...}}` does not shortcut its tests therefore it is
possible to cause a NPE unless you separate ifs into two.

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
  • Loading branch information
2 people authored and Yohann Delafollye committed Jul 31, 2020
1 parent 1b6c36c commit 9b65399
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions templates/repo/commit_page.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@
{{else}}
<i class="unlock icon"></i>
{{.i18n.Tr .Verification.Reason}}
{{if and .Verification.SigningKey (ne .Verification.SigningKey.KeyID "")}}
<span class="pull-right"><span class="ui text">{{.i18n.Tr "repo.commits.gpg_key_id"}}:</span> <i class="warning icon"></i>{{.Verification.SigningKey.KeyID}}</span>
{{if .Verification.SigningKey}}
{{if ne .Verification.SigningKey.KeyID ""}}
<span class="pull-right"><span class="ui text">{{.i18n.Tr "repo.commits.gpg_key_id"}}:</span> <i class="warning icon"></i>{{.Verification.SigningKey.KeyID}}</span>
{{end}}
{{end}}
{{end}}
</div>
Expand Down

0 comments on commit 9b65399

Please sign in to comment.