Skip to content

Commit

Permalink
[java producer] op.cmd may be null, cause NPE (#9400)
Browse files Browse the repository at this point in the history
* op.cmd may be null, cause NPE

* write null in the log
  • Loading branch information
xxxxpenny committed Feb 2, 2021
1 parent ca64811 commit 60f6238
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1484,9 +1484,9 @@ private void resendMessages(ClientCnx cnx) {
* @param op
*/
private void stripChecksum(OpSendMsg op) {
int totalMsgBufSize = op.cmd.readableBytes();
ByteBufPair msg = op.cmd;
if (msg != null) {
int totalMsgBufSize = msg.readableBytes();
ByteBuf headerFrame = msg.getFirst();
headerFrame.markReaderIndex();
try {
Expand Down Expand Up @@ -1518,8 +1518,7 @@ private void stripChecksum(OpSendMsg op) {
headerFrame.resetReaderIndex();
}
} else {
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName,
(op.cmd == null ? null : op.cmd.getClass().getName()));
log.warn("[{}] Failed while casting null into ByteBufPair", producerName);
}
}

Expand Down

0 comments on commit 60f6238

Please sign in to comment.