Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE while adding "response_body_size" breadcrumb (#1907) #1908

Merged
merged 4 commits into from Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,8 @@ Breaking changes:
`Timber.tag` is no longer supported by our [Timber integration](https://docs.sentry.io/platforms/android/configuration/integrations/timber/) and will not appear on Sentry for error events.
Please vote on this [issue](https://github.com/getsentry/sentry-java/issues/1900), if you'd like us to provide support for that.

* Fix: NPE while adding "response_body_size" breadcrumb, when response body length is unknown (#1907)
maciejwalkowiak marked this conversation as resolved.
Show resolved Hide resolved

## 5.6.1

* Fix: NPE while adding "response_body_size" breadcrumb, when response body is null (#1884)
Expand Down
Expand Up @@ -84,9 +84,8 @@ private void addBreadcrumb(final @NotNull Request request, final @Nullable Respo
request.httpMethod().name(),
response != null ? response.status() : null);
breadcrumb.setData("request_body_size", request.body() != null ? request.body().length : 0);
if (response != null) {
breadcrumb.setData(
"response_body_size", response.body() != null ? response.body().length() : 0);
if (response != null && response.body() != null && response.body().length() != null) {
breadcrumb.setData("response_body_size", response.body().length());
}
hub.addBreadcrumb(breadcrumb);
}
Expand Down