Skip to content

Commit e1afb65

Browse files
committed
Fix bug in keysplitting error handling in data channel
Dont overwrite the original err variable when using type assertion for KeysplittingError. This results in a null pointer error when building the Unknown KeysplittingError because the err variable was being assigned to a null pointer.
1 parent a004dcf commit e1afb65

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

agent/session/datachannel/datachannel.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,8 @@ func (dataChannel *DataChannel) processStreamDataMessage(log log.T, streamDataMe
882882
if err = dataChannel.inputStreamMessageHandler(log, streamDataMessage); err != nil {
883883
payloadType := mgsContracts.PayloadType(streamDataMessage.PayloadType)
884884
if payloadType == mgsContracts.Syn || payloadType == mgsContracts.Data {
885-
if err, ok := err.(*kysplContracts.KeysplittingError); ok { // Check if error is of type KeysplittingError
886-
dataChannel.SendKeysplittingMessage(log, err.Content)
885+
if kserr, ok := err.(*kysplContracts.KeysplittingError); ok { // Check if error is of type KeysplittingError
886+
dataChannel.SendKeysplittingMessage(log, kserr.Content)
887887
} else { // If it's not of type KeysplittingError, it's wrong so build one and send it
888888
dataChannel.SendKeysplittingMessage(log, keysplitting.BuildUnknownErrorPayload(err))
889889
}

0 commit comments

Comments
 (0)