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

Prevent lateinit property exception #969

Merged
merged 1 commit into from
Jun 17, 2024
Merged

Conversation

fractalwrench
Copy link
Contributor

Goal

The NetworkConnectivityService registers for network changes during its initialization. As this service has a bootstrapped reference to the DataSourceModule which is initialized after it, in rare circumstances where startup is slow + a network connectivity change happens this could result in access to a lateinit var that isn't initialized, which was captured as an internal error.

I've fixed this by ensuring that connectivity change registration only happens after the DataSourceModule is initialized.

@fractalwrench fractalwrench requested a review from a team as a code owner June 17, 2024 15:48
Copy link

codecov bot commented Jun 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.92%. Comparing base (6f71413) to head (2c66dc1).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #969      +/-   ##
==========================================
+ Coverage   80.91%   80.92%   +0.01%     
==========================================
  Files         444      444              
  Lines       11823    11824       +1     
  Branches     1807     1807              
==========================================
+ Hits         9566     9569       +3     
+ Misses       1462     1460       -2     
  Partials      795      795              
Files Coverage Δ
.../connectivity/EmbraceNetworkConnectivityService.kt 70.49% <ø> (+5.41%) ⬆️
...ure/connectivity/NoOpNetworkConnectivityService.kt 37.50% <100.00%> (+8.92%) ⬆️
...oid/embracesdk/injection/ModuleInitBootstrapper.kt 92.70% <100.00%> (+0.05%) ⬆️

... and 3 files with indirect coverage changes

Copy link
Collaborator

@bidetofevil bidetofevil left a comment

Choose a reason for hiding this comment

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

LGTM

@fractalwrench fractalwrench merged commit eea96b9 into master Jun 17, 2024
4 checks passed
@fractalwrench fractalwrench deleted the fix-lateinit-property branch June 17, 2024 16:46
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.

None yet

2 participants