Skip to content

Commit 48b6844

Browse files
committed
[font] throw when loading empty font file
1 parent acc2abd commit 48b6844

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/expo-asset/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
### 💡 Others
1616

17+
- [android] throw when loading empty font file ([#38229](https://github.com/expo/expo/pull/38229) by [@vonovak](https://github.com/vonovak))
18+
1719
## 11.1.7 - 2025-07-03
1820

1921
_This version does not introduce any user-facing changes._

packages/expo-font/android/src/main/java/expo/modules/font/FontLoaderModule.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ open class FontLoaderModule : Module() {
4444
val file = Uri.parse(localUri).path?.let { File(it) }
4545
?: throw FileNotFoundException(localUri)
4646

47+
if (file.length() == 0L) {
48+
throw CodedException(
49+
"Font file for $fontFamilyName is empty. Make sure the local file path is correctly populated."
50+
)
51+
}
52+
4753
Typeface.createFromFile(file)
4854
}
4955

0 commit comments

Comments
 (0)