1
0
mirror of https://github.com/golang/go synced 2024-11-25 21:37:58 -07:00

cmd/godoc: fix minor bug in FormatSelections.

FormatSelections tries to call a nil function value if lw is nil
and the final entry in the selections array is non-nil. Luckily,
this doesn't actually happen in practice since godoc doesn't use
this combination (no line numbers, but with selections).

R=gri
CC=gobot, golang-dev
https://golang.org/cl/6488106
This commit is contained in:
Paul Chang 2012-09-28 14:19:43 -07:00 committed by Robert Griesemer
parent 32eb110277
commit 7c8e26ee2f

View File

@ -108,7 +108,7 @@ func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection,
break break
} }
// determine the kind of segment change // determine the kind of segment change
if index == len(selections)-1 { if lw != nil && index == len(selections)-1 {
// we have a link segment change: // we have a link segment change:
// format the previous selection segment, write the // format the previous selection segment, write the
// link tag and start a new selection segment // link tag and start a new selection segment