Skip to content

RUM-9537: Catch NPE when drawing cloned drawable in Session Replay#2622

Merged
ambushwork merged 1 commit into
developfrom
yl/session-replay/crash-fix
Apr 29, 2025
Merged

RUM-9537: Catch NPE when drawing cloned drawable in Session Replay#2622
ambushwork merged 1 commit into
developfrom
yl/session-replay/crash-fix

Conversation

@ambushwork

Copy link
Copy Markdown
Member

What does this PR do?

We have a SDK crash reported:

2025-04-15 15:52:34.448 27880-28415 Datadog com.carvana.carvanaTest E java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.material.shape.ShapePath$PathOperation.applyToPath(android.graphics.Matrix, android.graphics.Path)' on a null object reference
at com.google.android.material.shape.ShapePath.applyToPath(ShapePath.java:244)
at com.google.android.material.shape.ShapeAppearancePathProvider.appendEdgePath(ShapeAppearancePathProvider.java:202)
at com.google.android.material.shape.ShapeAppearancePathProvider.calculatePath(ShapeAppearancePathProvider.java:135)
at com.google.android.material.shape.MaterialShapeDrawable.calculatePathForSize(MaterialShapeDrawable.java:1165)
at com.google.android.material.shape.MaterialShapeDrawable.calculatePath(MaterialShapeDrawable.java:1226)
at com.google.android.material.shape.MaterialShapeDrawable.draw(MaterialShapeDrawable.java:970)
at com.datadog.android.sessionreplay.internal.utils.DrawableUtils.drawOnCanvas(DrawableUtils.kt:117)
at com.datadog.android.sessionreplay.internal.utils.DrawableUtils.access$drawOnCanvas(DrawableUtils.kt:26)
at com.datadog.android.sessionreplay.internal.utils.DrawableUtils$createBitmapOfApproxSizeFromDrawable$1.onSuccess$lambda$0(DrawableUtils.kt:59)
at com.datadog.android.sessionreplay.internal.utils.DrawableUtils$createBitmapOfApproxSizeFromDrawable$1.$r8$lambda$KM5fqvVrfqCeggp4FNtAik4G8SQ(Unknown Source:0)

It turns out a internal crash from Material library when we draw the cloned drawable, we are not able to make any fix inside Material library, so we need to catch it and skip it.

Motivation

RUM-9537

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@codecov-commenter

codecov-commenter commented Apr 29, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.04%. Comparing base (5db245f) to head (e2920e4).
Report is 232 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2622      +/-   ##
===========================================
- Coverage    70.18%   70.04%   -0.14%     
===========================================
  Files          820      820              
  Lines        30571    30568       -3     
  Branches      5132     5132              
===========================================
- Hits         21454    21409      -45     
- Misses        7710     7730      +20     
- Partials      1407     1429      +22     
Files with missing lines Coverage Δ
...roid/sessionreplay/internal/utils/DrawableUtils.kt 95.95% <100.00%> (-0.16%) ⬇️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ambushwork
ambushwork marked this pull request as ready for review April 29, 2025 12:07
@ambushwork
ambushwork requested review from a team as code owners April 29, 2025 12:07
@ambushwork
ambushwork merged commit 0e0e229 into develop Apr 29, 2025
@ambushwork
ambushwork deleted the yl/session-replay/crash-fix branch April 29, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants