jameshartig commented on code in PR #1889:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1889#discussion_r2126860753


##########
session.go:
##########
@@ -454,6 +454,10 @@ func (s *Session) Bind(stmt string, b func(q *QueryInfo) 
([]interface{}, error))
 // Close closes all connections. The session is unusable after this
 // operation.
 func (s *Session) Close() {
+       // Closing a nil session is a non-event, return.
+       if s == nil {

Review Comment:
   This is a small change for such a large conversation but looking at the 
stdlib, I don't see any checks like this. 
   * close a nil `http.Server`: panic
   * close a nil `io.ReadCloser` from an `http.Response`: panic
   * close a nil `sql.Conn`: panic
   
   In general you should not be calling methods on nil pointers. I don't think 
we want to start some sort of precedent that we're going to be safe guarding 
callers who aren't checking for nil. This codebase is filled with pointers and 
methods that aren't guarding against this and I don't see the value in fixing 
one spot let alone spending the time to fix all of them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to