Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return error if writer is nil #8

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions wire/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,10 @@ func WriteMessageWithEncodingN(w io.Writer, msg Message, pver uint32,
// Write header and payload in 1 go.
// This w.Write() is locking, so we don't have to worry about concurrent writes.
var n int
n, err = w.Write(append(hw.Bytes(), payload...))
totalBytes += n
if hw != nil {
boecklim marked this conversation as resolved.
Show resolved Hide resolved
n, err = w.Write(append(hw.Bytes(), payload...))
totalBytes += n
}

return totalBytes, err
}
Expand Down