Skip to content

Commit

Permalink
Fix possible null pointer deference (#6184)
Browse files Browse the repository at this point in the history
Signed-off-by: vaidikcode <[email protected]>
## Which problem is this PR solving?
- Resolves #5981 

## Description of the changes
- This will cause a null pointer exception if trace is appended without
the if block being executed.

## How was this change tested?
- 

## Checklist
- [ ] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [ ] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [ ] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Co-authored-by: Yuri Shkuro <[email protected]>
  • Loading branch information
vaidikcode and yurishkuro authored Nov 10, 2024
1 parent 8441654 commit c88e0f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/storage/grpc/shared/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery
}

for i, span := range received.Spans {
if span.TraceID != traceID {
if trace == nil || span.TraceID != traceID {
trace = &model.Trace{}
traceID = span.TraceID
traces = append(traces, trace)
Expand Down

0 comments on commit c88e0f6

Please sign in to comment.