From 96fa7ece2529ea85936d609e6e70fe39b86b72d6 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Mon, 30 Sep 2019 21:11:37 +0300 Subject: [PATCH] Resolves #444 connection fix --- lib/managers/connection_manager.class.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/managers/connection_manager.class.dart b/lib/managers/connection_manager.class.dart index 063fe86..eb06438 100644 --- a/lib/managers/connection_manager.class.dart +++ b/lib/managers/connection_manager.class.dart @@ -100,7 +100,9 @@ class ConnectionManager { if (forceReconnect || !isConnected) { _connect().timeout(connectTimeout, onTimeout: () { _disconnect().then((_) { - completer?.completeError(HAError("Connection timeout")); + if (completer != null && !completer.isCompleted) { + completer.completeError(HAError("Connection timeout")); + } }); }).then((_) { completer?.complete();