yunge/gosphinx — pull request #2 by lye (2012-04-25 03:35:59+00:00)
Title: Fix a panic when all queries are in an error state. 

In the previous version, a query in an error state is not appended to
the list of all results. If all queries (e.g., the 1 query for me)
errors, then an empty results object gets passed out of `RunQueries` (with
a nil error). This causes a subsequent zero-index reference to panic in
the following bit:

results, err := sc.RunQueries()
if err != nil {
return nil, err
}

result = &results[0]
if result.Error != nil {
return nil, result.Error
}

This patch changes the code a bit to set `err` when an error is
encountered in a query and return it properly. This causes `Query` to
return before the bad dereference.