Fix #202: Postgres error when an endpoint has a second page but others do not

This commit is contained in:
TwiN
2021-11-16 22:56:16 -05:00
parent 31bf2aeb80
commit 2af3425b9e
2 changed files with 37 additions and 5 deletions

View File

@ -568,6 +568,10 @@ func (s *Store) getEndpointResultsByEndpointID(tx *sql.Tx, endpointID int64, pag
results = append([]*core.Result{result}, results...)
idResultMap[id] = result
}
if len(idResultMap) == 0 {
// If there's no result, we'll just return an empty/nil slice
return
}
// Get condition results
args := make([]interface{}, 0, len(idResultMap))
query := `SELECT endpoint_result_id, condition, success