don't call recycle if session was never initialized
@@ -440,8 +440,10 @@ func (t *ReadOnlyTransaction) Close() {
// If session handle is already destroyed, this becomes a noop.
// If there are still active queries and if the recycled session is reused before they complete, Cloud Spanner will cancel them
// on behalf of the new transaction on the session.
+ if sh != nil {
sh.recycle()
}
+}
// Timestamp returns the timestamp chosen to perform reads and
// queries in this transaction. The value can only be read after some
