Skip to content

Commit

Permalink
fix: crash when opening subtitle settings with possibly corrupt font …
Browse files Browse the repository at this point in the history
…files

closes #99
  • Loading branch information
abdallahmehiz committed Sep 23, 2024
1 parent b5a68f6 commit 78f4b1f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ fun SubtitleSettingsTypographyCard(
fileManager.fromUri(Uri.parse(preferences.fontsFolder.get())) ?: return@withContext,
).filter {
fileManager.isFile(it) && fileManager.getName(it).lowercase().matches(".*\\.[ot]tf$".toRegex())
}.map { TTFFile.open(fileManager.getInputStream(it)!!).families.values.first() },
}.mapNotNull {
runCatching { TTFFile.open(fileManager.getInputStream(it)!!).families.values.first() }.getOrNull()
},
)
fontsLoadingIndicator = null
}
Expand Down

0 comments on commit 78f4b1f

Please sign in to comment.