Skip to content

Commit

Permalink
Close managers that are no longer present
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment committed Sep 7, 2018
1 parent 0dc9245 commit e0aab87
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -826,15 +826,13 @@ protected void updateAudioManagerReferences()
it.advance();
final long guildId = it.key();
final AudioManagerImpl mng = (AudioManagerImpl) it.value();
ConnectionListener listener = mng.getConnectionListener();

GuildImpl guild = (GuildImpl) api.getGuildById(guildId);
if (guild == null)
{
//We no longer have access to the guild that this audio manager was for. Set the value to null.
queuedAudioConnections.remove(guildId);
if (listener != null)
listener.onStatusChange(ConnectionStatus.DISCONNECTED_REMOVED_FROM_GUILD);
mng.closeAudioConnection(ConnectionStatus.DISCONNECTED_REMOVED_FROM_GUILD);
it.remove();
}
}
Expand Down

0 comments on commit e0aab87

Please sign in to comment.