Skip to content

Commit 63e2c1d

Browse files
committed
Fix reconnect handling
1 parent bc81edf commit 63e2c1d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/active_record/connection_adapters/odbc_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def supports_migrations?
111111
# includes checking whether the database is actually capable of
112112
# responding, i.e. whether the connection isn't stale.
113113
def active?
114-
@unconfigured_connection.connected?
114+
@unconfigured_connection&.connected?
115115
end
116116

117117
# Disconnects from the database if already connected, and establishes a
@@ -133,7 +133,7 @@ def reconnect!
133133
# Disconnects from the database if already connected. Otherwise, this
134134
# method does nothing.
135135
def disconnect!
136-
@unconfigured_connection.disconnect if @unconfigured_connection.connected?
136+
@unconfigured_connection.disconnect if @unconfigured_connection&.connected?
137137
end
138138

139139
# Build a new column object from the given options. Effectively the same

0 commit comments

Comments
 (0)