mirror of
https://github.com/golang/go
synced 2024-11-18 06:24:47 -07:00
present: return an error for a bad link instead of panic
Change-Id: Ic41b2794268b6399bda01febafb85852f6634198 Reviewed-on: https://go-review.googlesource.com/44690 Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
b62b8c72b8
commit
92d42b9ff1
@ -24,6 +24,9 @@ func (l Link) TemplateName() string { return "link" }
|
||||
|
||||
func parseLink(ctx *Context, fileName string, lineno int, text string) (Elem, error) {
|
||||
args := strings.Fields(text)
|
||||
if len(args) < 3 {
|
||||
return nil, fmt.Errorf("link element must have at least 2 arguments")
|
||||
}
|
||||
url, err := url.Parse(args[1])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user