Closed RavuAlHemio closed 11 years ago
Fix looks good but this needs some extra care:
var prefixstr = RawProperties ["PREFIX"];
if (prefixstr == null) {
// supports no modes (!)
return modesList;
}
// format: (modes)prefixes
if (prefixstr [0] != '(') {
return null;
}
var modesPrefixes = prefixstr.Substring(1).Split(')');
The issue is prefixstr can be an empty string or 1 character both woud lead to a IndexOutOfBoundsException, please add to the null check || prefixstr.Length < 2
You're right -- and the class is really begging for unit tests anyway. If you could add a unit-test subproject to the SmartIrc4net solution, I'll write them.
Not skipping the leading '(' when splitting on the ')' always makes the modes list longer than the prefix list, which leads to an incorrect null return value.