Protect against possible nil pointer
@@ -458,12 +458,14 @@ func (s *Store) Execute(ex *ExecuteRequest) ([]*sql.Result, error) {
func (s *Store) ExecuteOrAbort(ex *ExecuteRequest) (results []*sql.Result, retErr error) {
defer func() {
var errored bool
+ if results != nil {
for i := range results {
if results[i].Error != "" {
errored = true
break
}
}
+ }
if retErr != nil || errored {
if err := s.db.AbortTransaction(); err != nil {
s.logger.Printf("WARNING: failed to abort transaction: %s", err.Error())
