Skip to content

Commit 82f14bf

Browse files
committed
fixed potential NPE
1 parent 70d1bd9 commit 82f14bf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/telemetry/HttpTracingLowLevelHttpResponse.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ public HttpTracingLowLevelHttpResponse(LowLevelHttpResponse delegate, Span span)
4242
@Override
4343
public InputStream getContent() throws IOException {
4444
if (countingInputStream == null) {
45-
if (span != null && span.getSpanContext().isValid()) {
46-
countingInputStream = getWrappedInputStream(span, delegate.getContent());
45+
InputStream originalContent = delegate.getContent();
46+
if (originalContent != null && span != null && span.getSpanContext().isValid()) {
47+
countingInputStream = getWrappedInputStream(span, originalContent);
48+
} else {
49+
countingInputStream = originalContent;
4750
}
4851
}
4952
return countingInputStream;

0 commit comments

Comments
 (0)