Add check to isChannelName for an empty string; return false if so
and don't try to index it. This avoids crashing on connect for some
situations.
Closes GH-307.
bool isChannelName(const QString &str)
{
bool isChannelName(const QString &str)
{
+ if (str.isEmpty())
+ return false;
static constexpr std::array<quint8, 4> prefixes{{'#', '&', '!', '+'}};
return std::any_of(prefixes.cbegin(), prefixes.cend(), [&str](quint8 c) { return c == str[0]; });
}
static constexpr std::array<quint8, 4> prefixes{{'#', '&', '!', '+'}};
return std::any_of(prefixes.cbegin(), prefixes.cend(), [&str](quint8 c) { return c == str[0]; });
}