diff options
author | Qais Patankar <qaisjp@gmail.com> | 2020-04-25 13:22:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 14:22:22 +0200 |
commit | 2d8f749e361eeca5da698138a42e182fdfea4713 (patch) | |
tree | 7dff3128d1dbcf851cf7947b12d43a2efa42f282 /bridge/discord | |
parent | a18cb74f037890952fc6ebbfd98005e64a2c15f6 (diff) | |
download | matterbridge-msglm-2d8f749e361eeca5da698138a42e182fdfea4713.tar.gz matterbridge-msglm-2d8f749e361eeca5da698138a42e182fdfea4713.tar.bz2 matterbridge-msglm-2d8f749e361eeca5da698138a42e182fdfea4713.zip |
Fix #1120: replaceAction "_" crash (discord) (#1121)
Diffstat (limited to 'bridge/discord')
-rw-r--r-- | bridge/discord/helpers.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bridge/discord/helpers.go b/bridge/discord/helpers.go index 00592f3a..e183165c 100644 --- a/bridge/discord/helpers.go +++ b/bridge/discord/helpers.go @@ -188,8 +188,9 @@ func replaceEmotes(text string) string { } func (b *Bdiscord) replaceAction(text string) (string, bool) { - if strings.HasPrefix(text, "_") && strings.HasSuffix(text, "_") { - return text[1 : len(text)-1], true + length := len(text) + if length > 1 && text[0] == '_' && text[length-1] == '_' { + return text[1 : length-1], true } return text, false } |