Skip to content

Commit 0ee0c12

Browse files
author
Chris Bellew
committed
When testing for an active connection, if the server has no connections (which can happen if the app has been in use since before multiple connections were supported), create one using the server's address and port.
1 parent 7c53a7f commit 0ee0c12

File tree

1 file changed

+6
-1
lines changed
  • Voice Control For Plex/src/main/java/com/atomjack/vcfp/model

1 file changed

+6
-1
lines changed

Voice Control For Plex/src/main/java/com/atomjack/vcfp/model/PlexServer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,13 @@ public void findServerConnection(final ServerFindHandler handler) {
149149
// If this server already has an active connection, just return it without trying it again.
150150
if(activeConnection != null)
151151
handler.onSuccess();
152-
else
152+
else {
153+
// If this server has no connections, create one with the server's address and port.
154+
// This can happen if a user was using the app before multiple connections were supported.
155+
if(connections.size() == 0)
156+
connections.add(new Connection("http", address, port));
153157
findServerConnection(0, handler);
158+
}
154159
}
155160

156161
private void findServerConnection(final int connectionIndex, final ServerFindHandler handler) {

0 commit comments

Comments
 (0)