修复读取msg可能为空的情况

This commit is contained in:
langhuihui
2023-04-23 10:23:00 +08:00
parent ac4de208b8
commit 67cfaff62e

View File

@@ -255,7 +255,7 @@ func (conn *NetConnection) RecvMessage() (msg *Chunk, err error) {
err = conn.SendMessage(RTMP_MSG_ACK, Uint32Message(conn.totalRead))
}
for msg == nil && err == nil {
if msg, err = conn.readChunk(); msg != nil {
if msg, err = conn.readChunk(); msg != nil && err == nil {
switch msg.MessageTypeID {
case RTMP_MSG_CHUNK_SIZE:
conn.readChunkSize = int(msg.MsgData.(Uint32Message))