From a59b7d44d6f2f9ddd38cee405647c78919b6b3fa Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 7 Jan 2024 08:03:25 -0500 Subject: [PATCH] fix: bad type conversion, and add a panic --- protocol/base/incoming_message.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protocol/base/incoming_message.go b/protocol/base/incoming_message.go index f6e4a56..3b42c1c 100644 --- a/protocol/base/incoming_message.go +++ b/protocol/base/incoming_message.go @@ -43,7 +43,12 @@ func (i *IncomingMessageImpl) Original() []byte { } func (i *IncomingMessageImpl) SetIncomingMessage(msg IncomingMessage) { - *i = interface{}(msg).(IncomingMessageImpl) + if msgImpl, ok := msg.(*IncomingMessageImpl); ok { + *i = *msgImpl + } else { + // Handle the error or panic + panic("msg is not of type *IncomingMessageImpl") + } } func (i *IncomingMessageImpl) GetKind() types.ProtocolMethod {