Bounds check proxy tags before extracting inner message
This commit is contained in:
parent
1577eb7041
commit
52962f1b97
@ -72,7 +72,7 @@ namespace PluralKit.Bot
|
||||
var prefix = potential.Member.Prefix ?? "";
|
||||
var suffix = potential.Member.Suffix ?? "";
|
||||
|
||||
if (message.StartsWith(prefix) && message.EndsWith(suffix)) {
|
||||
if (message.Length >= prefix.Length + suffix.Length && message.StartsWith(prefix) && message.EndsWith(suffix)) {
|
||||
var inner = message.Substring(prefix.Length, message.Length - prefix.Length - suffix.Length);
|
||||
if (leadingMention != null) inner = $"{leadingMention} {inner}";
|
||||
return new ProxyMatch { Member = potential.Member, System = potential.System, InnerText = inner };
|
||||
|
Loading…
Reference in New Issue
Block a user