Resolves #444 connection fix

This commit is contained in:
estevez-dev 2019-09-30 21:11:37 +03:00
parent b84caa4cc3
commit 96fa7ece25

View File

@ -100,7 +100,9 @@ class ConnectionManager {
if (forceReconnect || !isConnected) { if (forceReconnect || !isConnected) {
_connect().timeout(connectTimeout, onTimeout: () { _connect().timeout(connectTimeout, onTimeout: () {
_disconnect().then((_) { _disconnect().then((_) {
completer?.completeError(HAError("Connection timeout")); if (completer != null && !completer.isCompleted) {
completer.completeError(HAError("Connection timeout"));
}
}); });
}).then((_) { }).then((_) {
completer?.complete(); completer?.complete();