Improve telnet readString error handling

master
HimbeerserverDE 2022-04-22 18:18:53 +02:00
parent b8725fa08a
commit d0ec2ea653
No known key found for this signature in database
GPG Key ID: A3D3E205DA0B0401
1 changed files with 4 additions and 4 deletions

View File

@ -64,13 +64,13 @@ func handleTelnet(conn net.Conn) {
readString := func(delim byte) (string, error) {
s, err := bufio.NewReader(conn).ReadString(delim)
i := int(math.Max(float64(len(s)-1), 1))
if len(s) == 0 {
if err != nil || len(s) == 0 {
return s, err
}
i := int(math.Max(float64(len(s)-1), 1))
s = s[:i]
return s, err
return s, nil
}
writeString := func(s string) (n int, err error) {