Skip to content

fix(perf): add null check in case trace, screenTraces & httpMetric SparseArrays are cleared during module teardown#8946

Merged
mikehardy merged 1 commit intomainfrom
fix-perf-8938
Mar 31, 2026
Merged

fix(perf): add null check in case trace, screenTraces & httpMetric SparseArrays are cleared during module teardown#8946
mikehardy merged 1 commit intomainfrom
fix-perf-8938

Conversation

@russellwheatley
Copy link
Copy Markdown
Member

Description

fixes #8938

Related issues

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

…arseArrays are cleared during module teardown
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-firebase Error Error Mar 30, 2026 10:27am

Request Review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces null checks in the stopTrace, stopScreenTrace, and stopHttpMetric methods within UniversalFirebasePerfModule.java. These additions prevent potential NullPointerExceptions that might occur if traces or metrics are cleared during module teardown before the JavaScript layer stops them. I have no feedback to provide.

Copy link
Copy Markdown
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a reasonable approach
confirmed that at the JS layer the pathway is always:

1- verify arguments and such before calling down to native
2- return the result of a call to native

And in native all pathways were

1- do things
2- always return null

So adding null safety here then returning null is a graceful way to handle it

@mikehardy
Copy link
Copy Markdown
Collaborator

macOS CI failure unrelated, see:

Non-blocking

@mikehardy mikehardy merged commit ded0be2 into main Mar 31, 2026
20 of 22 checks passed
@mikehardy mikehardy deleted the fix-perf-8938 branch March 31, 2026 14:54
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.

[🐛] Attempt to invoke virtual method 'void com.google.firebase.perf.metrics.Trace.stop()' on a null object reference

3 participants