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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): crash when app visible time isn't available to calculate launch time #1183

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

abhaysood
Copy link
Contributor

@abhaysood abhaysood commented Sep 4, 2024

Description

On certain devices we're detecting a warm/hot launch without having the lastAppVisibleTime set, which is unusual. This causes a NPE. This PR discards the event and logs an error instead of crashing in such a case.

This PR also adds two more safe checks to LaunchTracker:

  1. Removes usage of getValue when accessing maps which can potentially throw.
  2. Removes an explicit throw and replaces it with an error log.

Related issue

closes #1180

@abhaysood abhaysood added bug something isn't working android android related labels Sep 4, 2024
@abhaysood abhaysood self-assigned this Sep 4, 2024
Copy link

vercel bot commented Sep 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
measure-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 4, 2024 11:36am

Avoid using `getValue` on a map which can potentially throw if the
value for specified key isn't set
@abhaysood abhaysood merged commit d683f44 into main Sep 4, 2024
9 checks passed
@abhaysood abhaysood deleted the fix-launch-tracker-npe branch September 4, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android android related bug something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

NullPointerException in LaunchTracker.kt
2 participants