diff --git a/src/net/tools/naive/naive_connection.cc b/src/net/tools/naive/naive_connection.cc index 86f129a707..fb218b353a 100644 --- a/src/net/tools/naive/naive_connection.cc +++ b/src/net/tools/naive/naive_connection.cc @@ -301,12 +301,13 @@ int NaiveConnection::DoConnectServerComplete(int result) { } int NaiveConnection::Run(CompletionOnceCallback callback) { - DCHECK(sockets_[kClient]); DCHECK(sockets_[kServer]); DCHECK_EQ(next_state_, STATE_NONE); DCHECK(!connect_callback_); - if (errors_[kClient] != OK) + // The client-side socket may be closed before the server-side + // socket is connected. + if (errors_[kClient] != OK || sockets_[kClient] == nullptr) return errors_[kClient]; if (errors_[kServer] != OK) return errors_[kServer];