1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:54:45 -07:00

godoc: Fix dereference of nil *SearchResult.

Fixes golang/go#7364.

R=bradfitz
CC=golang-codereviews, sameer
https://golang.org/cl/66470044
This commit is contained in:
Brad Garcia 2014-02-20 11:26:05 -05:00
parent fcad4a15d8
commit 804b9654fe

View File

@ -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()