projects
/
quassel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fa9ff5
)
common: Fix isChannelName crash on empty string
author
Shane Synan
<digitalcircuit36939@gmail.com>
Mon, 4 Sep 2017 08:52:25 +0000
(
03:52
-0500)
committer
Manuel Nickschas
<sputnick@quassel-irc.org>
Mon, 4 Sep 2017 17:20:59 +0000
(19:20 +0200)
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.
src/common/util.cpp
patch
|
blob
|
history
diff --git
a/src/common/util.cpp
b/src/common/util.cpp
index
3d199a1
..
a59db8f
100644
(file)
--- a/
src/common/util.cpp
+++ b/
src/common/util.cpp
@@
-64,6
+64,8
@@
QString hostFromMask(const QString &mask)
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]; });
}