apache / apache/pulsar-client-go
message.GetSchemaValue() panics if message.schema is nil
- Dominant language
- Go
- Stars
- 745
- Forks
- 389
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 3
Description
#### Expected behavior
Calling message.GetSchemaValue() should handle nil pointer deref on message.schema, and return error and not panic
#### Actual behavior
Calling message.GetSchemaValue() when schema is nil panics
#### Steps to reproduce
```
consumer, err := (*ps.Client).Subscribe(apachePulsar.ConsumerOptions{
Topic: topic, // some topic name
SubscriptionName: name,
MessageChannel: listenerChan, // a channel for incoming messages
Type: apachePulsar.Shared,
Schema: schema,
})
func handler() { err := msg.GetSchemaValue(val) }
for cm := range listenerChan {
msg := cm.Message
go func() {
handler(msg)
(*consumer).Ack(msg)
}()
}
```
handler panics, process dies
#### Notes: unclear why schema is undefined, producer for topic in this test is registered with schema. Utilizing protobuf schema, which is succesfully created using NewProtoSchema
#### System configuration
**Pulsar version**: 2.7.0
**pulsar-client-go**: v0.3.0
Contributor guide
Assessment
This issue has not been assessed yet.