Skip to content

Commit

Permalink
avoid crash with bad xml format (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran committed Nov 26, 2024
1 parent 6d6fb8d commit 05a52f2
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ fun WhatsNewDialog(onDismissRequest: () -> Unit) {
Column {
val changelog by produceState<List<DisplayChangelog>?>(initialValue = null) {
value = withIOContext {
XML.decodeFromReader<Changelog>(
AndroidXmlReader(
context.resources.openRawResource(
if (isReleaseBuildType) R.raw.changelog_release else R.raw.changelog_preview,
).bufferedReader(),
),
).toDisplayChangelog()
try {
XML.decodeFromReader<Changelog>(
AndroidXmlReader(
context.resources.openRawResource(
if (isReleaseBuildType) R.raw.changelog_release else R.raw.changelog_preview,
).bufferedReader(),
),
).toDisplayChangelog()
} catch (e: Exception) {
emptyList()
}
}
}
if (changelog != null) {
Expand Down

0 comments on commit 05a52f2

Please sign in to comment.