-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[font] throw when loading empty font file #38229
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
[font] throw when loading empty font file #38229
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
The Pull Request introduced fingerprint changes against the base commit: acc2abd Fingerprint diff[
{
"op": "changed",
"beforeSource": {
"type": "dir",
"filePath": "../../packages/expo-font/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "c2e452a3401e195afc849d4c6d3ac6161a8f89d4"
},
"afterSource": {
"type": "dir",
"filePath": "../../packages/expo-font/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "4a66a1b5b2ac878f4eaf482f021cfeb9ec9f36f3"
}
}
] Generated by PR labeler 🤖 |
54424ba
to
01567ea
Compare
Subscribed to pull request
Generated by CodeMention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
01567ea
to
48b6844
Compare
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines. I've found some issues in your pull request that should be addressed (click on them for more details) 👇
|
Why
This PR adds a check to prevent loading empty font files on Android. This normally wouldn't happen but if it did, Android TypeFace throws
ArrayIndexOutOfBoundsException
which is pretty useless for debugging.How
Added a simple check in the
FontLoaderModule.kt
file that verifies if the font file has a non-zero length before attempting to create a Typeface from it. If the file is empty (length is 0), it throws aCodedException
with a error message that's better thanArrayIndexOutOfBoundsException
.Test Plan
Checklist
changelog.md
entry and rebuilt the package sources according to this short guidenpx expo prebuild
& EAS Build (eg: updated a module plugin).