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 2 commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@
## Unreleased

* Fix: Do not include stacktrace frames into Timber message (#1898)
* Fix: NPE while adding "response_body_size" breadcrumb, when response body length is unknown (#1907)
marandaneto marked this conversation as resolved.
Show resolved Hide resolved

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.
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