From 7c8e26ee2f47541dbc5865e00bf1862b449a1b64 Mon Sep 17 00:00:00 2001 From: Paul Chang Date: Fri, 28 Sep 2012 14:19:43 -0700 Subject: [PATCH] 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 --- src/cmd/godoc/format.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/godoc/format.go b/src/cmd/godoc/format.go index 3b1b9a8226e..64f4b80305c 100644 --- a/src/cmd/godoc/format.go +++ b/src/cmd/godoc/format.go @@ -108,7 +108,7 @@ func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection, break } // determine the kind of segment change - if index == len(selections)-1 { + if lw != nil && index == len(selections)-1 { // we have a link segment change: // format the previous selection segment, write the // link tag and start a new selection segment