From 804b9654fe551db8578802d4b14094e095e253ce Mon Sep 17 00:00:00 2001 From: Brad Garcia Date: Thu, 20 Feb 2014 11:26:05 -0500 Subject: [PATCH] godoc: Fix dereference of nil *SearchResult. Fixes golang/go#7364. R=bradfitz CC=golang-codereviews, sameer https://golang.org/cl/66470044 --- godoc/search.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/godoc/search.go b/godoc/search.go index 7ba5dc4c7a..e12633065e 100644 --- a/godoc/search.go +++ b/godoc/search.go @@ -34,9 +34,9 @@ func (c *Corpus) Lookup(query string) SearchResult { index, timestamp := c.CurrentIndex() if index != nil { // identifier search - var err error - result, err = index.Lookup(query) - if err != nil && !c.IndexFullText { + if r, err := index.Lookup(query); err == nil { + result = r + } else if err != nil && !c.IndexFullText { // ignore the error if full text search is enabled // since the query may be a valid regular expression result.Alert = "Error in query string: " + err.Error()