Fixed code whereby mutex would never be unlocked if channel was found

This commit is contained in:
Tristan B. Kildaire 2020-09-25 10:21:58 +02:00
parent bf74c74891
commit 723d44aa1f
1 changed files with 6 additions and 2 deletions

View File

@ -131,6 +131,9 @@ public class DServer : Thread
public DChannel getChannelByName(string channelName) public DChannel getChannelByName(string channelName)
{ {
/* The channel */
DChannel channel = null;
/* Lock the channels list */ /* Lock the channels list */
channelLock.lock(); channelLock.lock();
@ -138,14 +141,15 @@ public class DServer : Thread
{ {
if(cmp(currentChannel.getName(), channelName) == 0) if(cmp(currentChannel.getName(), channelName) == 0)
{ {
return currentChannel; channel = currentChannel;
break;
} }
} }
/* Unlock the channels list */ /* Unlock the channels list */
channelLock.unlock(); channelLock.unlock();
return null; return channel;
} }
public DChannel[] getChannels() public DChannel[] getChannels()