diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index c9159a7f..055f14dc 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2810,9 +2810,16 @@ namespace WebSocketSharp /// public void SetCredentials (string username, string password, bool preAuth) { + string msg; + if (!checkIfAvailable (true, false, true, false, false, true, out msg)) { + _logger.Error (msg); + error ("An error has occurred in setting the credentials.", null); + + return; + } + lock (_forConn) { - string msg; - if (!checkIfAvailable (true, false, true, false, false, true, out msg)) { + if (!checkIfAvailable (true, false, false, true, out msg)) { _logger.Error (msg); error ("An error has occurred in setting the credentials.", null);