ircmsg: Improve robustness
This commit is contained in:
parent
649590699f
commit
63f6c66ea1
@ -63,6 +63,10 @@ func ParseLine(line string) (IrcMessage, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if len(line) < 1 {
|
||||
return ircmsg, ErrorLineIsEmpty
|
||||
}
|
||||
|
||||
// prefix
|
||||
if line[0] == ':' {
|
||||
splitLine := strings.SplitN(line, " ", 2)
|
||||
@ -70,6 +74,10 @@ func ParseLine(line string) (IrcMessage, error) {
|
||||
line = strings.TrimLeft(splitLine[1], " ")
|
||||
}
|
||||
|
||||
if len(line) < 1 {
|
||||
return ircmsg, ErrorLineIsEmpty
|
||||
}
|
||||
|
||||
// command
|
||||
splitLine := strings.SplitN(line, " ", 2)
|
||||
ircmsg.Command = strings.ToUpper(splitLine[0])
|
||||
|
Loading…
Reference in New Issue
Block a user