Skip to content

Commit

Permalink
fix(join): isChannelNameFree wrong match
Browse files Browse the repository at this point in the history
it transformed to lowercase before checking, even though channel names are case sensitive, causing exceptions down the line
  • Loading branch information
mxafi committed Mar 23, 2024
1 parent b8c06eb commit 214542d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/channel/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,8 @@ bool Channel::isChannelNameValid(const std::string& name) {
}

bool Channel::isChannelNameFree(const std::string& name, std::map<std::string, Channel>& allChannels) {
std::string lowercaseName = name;
std::transform(lowercaseName.begin(), lowercaseName.end(), lowercaseName.begin(), ::tolower);

for (auto it = allChannels.begin(); it != allChannels.end(); it++) {
if (it->second.getName() == lowercaseName) {
if (it->second.getName() == name) {
return false;
}
}
Expand Down

0 comments on commit 214542d

Please sign in to comment.