apache / rocketmq-client-go

Apache RocketMQ go client
https://rocketmq.apache.org/
Apache License 2.0
1.3k stars 419 forks source link

[ISSUE #1124] fix: panic in SendResult.String #1125

Closed MaOreoreorui closed 7 months ago

MaOreoreorui commented 9 months ago

What is the purpose of the change

The String() method in SendResult struct can cause a panic when MessageQueue field is nil. This is because String() method tries to access MessageQueue.String() without checking if MessageQueue is nil.

Brief changelog

This PR adds a nil check for MessageQueue before calling its String() method. If MessageQueue is nil, it uses the string "nil" to represent it.

This solution prevents the panic and makes SendResult.String() method more robust.

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.