Commit db042d2d authored by Samuel Tan's avatar Samuel Tan Committed by Dmitri Shuralyov
Browse files

html/template: handle nil Error values in context.String

Add a special case to print a generic nil error when context.err is
nil.

Previously, this case was unchecked, leading to a call to (*Error).Error
with a nil receiver, which was triggering a nil pointer access. However,
this bug was masked by the panic-recovery code in package fmt.

I tested this change by running `dlv test` in src/html/template, running
the `continue` command, and verifying that no "bad access" errors are
returned.

Fixes #28854

Change-Id: I0b637b943de003d9efc294f6f1e49b793668d037
Reviewed-on: https://go-review.googlesource.com/c/go/+/181579


Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
parent 530097fe
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment