Browse Source

Check if flight or flight.info is not nil. Without this check a panic then subsequent deadlock can occur

Nimi Wariboko 11 years ago
parent
commit
9a7025c769
1 changed files with 3 additions and 0 deletions
  1. 3 0
      conn.go

+ 3 - 0
conn.go

@@ -505,6 +505,9 @@ func (c *Conn) executeBatch(batch *Batch) error {
 		c.prepMu.Lock()
 		found := false
 		for stmt, flight := range c.prep {
+			if flight == nil || flight.info == nil {
+				continue
+			}
 			if bytes.Equal(flight.info.id, x.StatementId) {
 				found = true
 				delete(c.prep, stmt)