Skip to content

Commit

Permalink
Fix potential null-dereference in CommandHandler #1703
Browse files Browse the repository at this point in the history
  • Loading branch information
wbzj1110 authored Apr 7, 2021
1 parent dfacd06 commit af60f59
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/io/lettuce/core/protocol/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,15 @@ private void writeSingleCommand(ChannelHandlerContext ctx, RedisCommand<?, ?, ?>
span.tag("redis.args", command.getArgs().toCommandString());
}

span.remoteEndpoint(tracedEndpoint);
if (tracedEndpoint != null) {
span.remoteEndpoint(tracedEndpoint);
} else {
span.remoteEndpoint(clientResources.tracing().createEndpoint(ctx.channel().remoteAddress()));
}
span.start();
provider.setSpan(span);
if (provider != null) {
provider.setSpan(span);
}

CompleteableCommand<?> completeableCommand = (CompleteableCommand<?>) command;
completeableCommand.onComplete((o, throwable) -> {
Expand Down

0 comments on commit af60f59

Please sign in to comment.