From de5d3e94fb9ed0d17d31622ae113ce9fb009344d Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Fri, 17 Jan 2020 14:11:33 -0500 Subject: [PATCH] Fix connection bug TODO: We really should do something better about informing the user of connection errors and the like. --- Persephone/MPDClient/Extensions/MPDClient+Connection.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Persephone/MPDClient/Extensions/MPDClient+Connection.swift b/Persephone/MPDClient/Extensions/MPDClient+Connection.swift index b18295b..9407ba6 100644 --- a/Persephone/MPDClient/Extensions/MPDClient+Connection.swift +++ b/Persephone/MPDClient/Extensions/MPDClient+Connection.swift @@ -40,7 +40,9 @@ extension MPDClient { let commandOperation = BlockOperation() { [unowned self] in self.sendCommand(command: .connect, userData: ["host": host, "port": port]) - self.idle() + if self.isConnected { + self.idle() + } } commandQueue.addOperation(commandOperation) }