diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index 9a07782b9..e1923b04a 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -888,10 +888,12 @@ impl Session { // 2. If the connection is established, send `Data::Close`. // 3. If the connection is disconnected, do nothing. let mut connection_round_state_lock = self.connection_round_state.lock().unwrap(); - match connection_round_state_lock.state { - ConnectionState::Connecting => return, - ConnectionState::Connected => self.send(Data::Close), - ConnectionState::Disconnected => {} + if self.thread.lock().unwrap().is_some() { + match connection_round_state_lock.state { + ConnectionState::Connecting => return, + ConnectionState::Connected => self.send(Data::Close), + ConnectionState::Disconnected => {} + } } let round = connection_round_state_lock.new_round(); drop(connection_round_state_lock);