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: Fix any initialization errors in getFormats() (e.g. IllegalArgumentException - width must be positive) #3236

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

mrousavy
Copy link
Owner

What

Fixes any kinds of initialization errors in getFormats() that could cause the app to crash when starting up (as constants are evaluated outside of the React Native JS code / error handler).

We just wrap it in a try/catch, and if for some reason any of those getters throw (which they definitely should not do, according to the Android documentation), then we catch and ignore that specific format.

Those getters can only throw if the host OS (Samsung, Huawei, ..) has implemented the Android spec poorly or missed something. In that case, it's not my fault, but I have to work around those issues anyways.

Changes

Tested on

Related issues

…gumentException - width must be positive`)
Copy link

vercel bot commented Oct 10, 2024

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

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 1:40pm

@mrousavy mrousavy merged commit e66f187 into main Oct 10, 2024
5 checks passed
@mrousavy mrousavy deleted the fix/initialization-exception branch October 10, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant