X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fignorelistmanager.h;h=baf3cc103112ef61b54419d9cfa5329cb4e7f150;hp=7bf4bab3a273e31c06c06b5aabb2e4f9016a7e7a;hb=6fd69e84e6c395a108e6b2620c6428907b7d7efd;hpb=5b397a71c0f4827c3050659c39749d78831a0d6d diff --git a/src/common/ignorelistmanager.h b/src/common/ignorelistmanager.h index 7bf4bab3..baf3cc10 100644 --- a/src/common/ignorelistmanager.h +++ b/src/common/ignorelistmanager.h @@ -122,10 +122,27 @@ public: // This is not performance-intensive; sticking with QRegExp for Qt 4 is fine // Split based on whitespace characters QStringList split(contents().split(QRegExp("\\s+"), QString::SkipEmptyParts)); - // Match on the first item - _cacheCtcpSender = split.takeFirst(); - // Track the rest as CTCP types to ignore - _cacheCtcpTypes = split; + // Match on the first item, handling empty rules/matches + if (!split.isEmpty()) { + // Take the first item as the sender + _cacheCtcpSender = split.takeFirst(); + // Track the rest as CTCP types to ignore + _cacheCtcpTypes = split; + } + else { + // No match found - this can happen if a pure whitespace CTCP ignore rule is + // created. Fall back to matching all senders. + if (_isRegEx) { + // RegEx match everything + _cacheCtcpSender = ".*"; + } + else { + // Wildcard match everything + _cacheCtcpSender = "*"; + } + // Clear the types (split is already empty) + _cacheCtcpTypes = split; + } } _type = type; }