fix: bad type conversion, and add a panic

This commit is contained in:
Derrick Hammer 2024-01-07 08:03:25 -05:00
parent be082fda60
commit a59b7d44d6
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -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 {