Skip to content

Commit

Permalink
Fix NPE while adding "response_body_size" breadcrumb (#1907) (#1908)
Browse files Browse the repository at this point in the history
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
  • Loading branch information
3 people committed Feb 24, 2022
1 parent 4d43152 commit 7e64490
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Fix: NPE while adding "response_body_size" breadcrumb, when response body length is unknown (#1908)

## 5.6.2-beta.1

* Fix: Do not include stacktrace frames into Timber message (#1898)
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

0 comments on commit 7e64490

Please sign in to comment.