summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley/girc/event.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-05-02 00:10:54 +0200
committerGitHub <noreply@github.com>2022-05-02 00:10:54 +0200
commit81e6f75aa491c7bfa11780dd622587cf5fff3c8f (patch)
tree817bca1b4071842029af876ab622bfdcb0360cca /vendor/github.com/lrstanley/girc/event.go
parent888c8b9a845866730485a3a88c27027d0960d521 (diff)
downloadmatterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.tar.gz
matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.tar.bz2
matterbridge-msglm-81e6f75aa491c7bfa11780dd622587cf5fff3c8f.zip
Update dependencies (#1822)
Diffstat (limited to 'vendor/github.com/lrstanley/girc/event.go')
-rw-r--r--vendor/github.com/lrstanley/girc/event.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/lrstanley/girc/event.go b/vendor/github.com/lrstanley/girc/event.go
index 0ca06976..7801615d 100644
--- a/vendor/github.com/lrstanley/girc/event.go
+++ b/vendor/github.com/lrstanley/girc/event.go
@@ -52,7 +52,7 @@ func ParseEvent(raw string) (e *Event) {
i = 0
}
- if raw[0] == messagePrefix {
+ if raw != "" && raw[0] == messagePrefix {
// Prefix ends with a space.
i = strings.IndexByte(raw, eventSpace)
@@ -297,7 +297,9 @@ func (e *Event) Bytes() []byte {
buffer.Truncate(maxLength)
}
- out := buffer.Bytes()
+ // If we truncated in the middle of a utf8 character, we need to remove
+ // the other (now invalid) bytes.
+ out := bytes.ToValidUTF8(buffer.Bytes(), nil)
// Strip newlines and carriage returns.
for i := 0; i < len(out); i++ {