Update websocket.go

This commit is contained in:
Bernd Schoolmann 2024-06-02 21:45:12 +02:00 committed by GitHub
parent d32147bdf8
commit 79bfc43ab8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -255,12 +255,11 @@ func parseMessageTypeFromMessagePack(messagePack []byte) (int8, string, bool) {
return 0, "", false return 0, "", false
} }
if len(value) < 5 { if len(value) < 5 {
websocketLog.Warn("Invalid message received, length too short")
return 0, "", false return 0, "", false
} }
value, success := value[4].([]interface{}) value, success := value[4].([]interface{})
if len(value) < 1 || !success { if len(value) < 1 || !success {
websocketLog.Warn("Invalid message received, length too short") websocketLog.Warn("Invalid message received, value length less than 1")
return 0, "", false return 0, "", false
} }
value1, success := value[0].(map[string]interface{}) value1, success := value[0].(map[string]interface{})