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: Attempting to launch an unregistered ActivityResultLauncher #4529

Merged
merged 1 commit into from Mar 14, 2022

Conversation

g123k
Copy link
Contributor

@g123k g123k commented Mar 13, 2022

The ActivityResultLauncher must be initialized in the onCreate method, otherwise the app may crash.
Fix for #4528

The ActivityResultLauncher must be initialized in the onCreate method, otherwise the app may crash
@g123k g123k requested a review from a team as a code owner March 13, 2022 09:08
@sonarcloud
Copy link

sonarcloud bot commented Mar 13, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@teolemon teolemon linked an issue Mar 13, 2022 that may be closed by this pull request
@VaiTon
Copy link
Member

VaiTon commented Mar 13, 2022

@g123k thanks for taking the time to fix this!

Any idea about why isn't it working when put as a field initializer? Isn't it how the Android docs recommend?

@g123k
Copy link
Contributor Author

g123k commented Mar 14, 2022

@g123k thanks for taking the time to fix this!

Any idea about why isn't it working when put as a field initializer? Isn't it how the Android docs recommend?

Since your implementation was based on a getter, unless you call it directly, it is never created.
The other solution would be to clearly create it within an init block

@VaiTon
Copy link
Member

VaiTon commented Mar 14, 2022

@g123k sorry to bother you, but wasn't it without a get() = block?

@VaiTon VaiTon merged commit 51f7767 into openfoodfacts:develop Mar 14, 2022
@g123k
Copy link
Contributor Author

g123k commented Mar 15, 2022

Look at the generated code in Java:

Screen Shot 2022-03-15 at 09 06 34

This is indeed a getter

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.

The app is crashing when editing a product
2 participants